Preface :
This is a little story about how I read my emails on my smartphone with Mutt. This is mainly intended as documentation for myself. I don’t claim that this is the perfect solution, but it works great for me 😀
If you think my setup is stupid, you are probably right 😉
My mail setup at $HOME :
At home, on a small computer with debian GNU/Linux installed, I use a combination of fetchmail/postfix/procmail to get my email and store it locally in maildir format. With syncthing I synchronize this maildir with other devices.
My smartphone setup :
On my smartphone I use postmarketOS with Sxmo.
Syncthing : Installation
I’ve installed syncthing on my smartphone with apk add syncthing
and created the file /etc/conf.d/syncthing
to make syncthing run as
user jan (default user on my smartphone).
shift6mq [~]$ cat /etc/conf.d/syncthing
# /etc/conf.d/syncthing
SYNCTHING_USER=jan
I’ve used rc-update add syncthing
to enable syncthing at boot time.
Syncthing : Setup
The configuration page of syncthing is at http://127.0.0.1:8384
.
With firefox, I’ve configured syncthing to share /home/jan/Maildir
between my smartphone and home.
muttrc
To be able to send email when I’m not at home, I’ve added the following to my
~/.muttrc
# rechtstreeks SMTP server aanspreken
set my_email = "blabla@blabla.bla"
set my_password = "ZeerGeheimPaswoord"
set ssl_starttls=yes
set smtp_url="smtp://$my_email@blabla.bla:2525/"
set smtp_pass="$my_password"
Because the screen of a smartphone is limited,
I’ve also added set folder_format="%2C %t %N %f"
to ~/.muttrc
.
Notifications
To get notifications when new mail arrives, I’ve added the following to ~/.config/sxmo/hooks/sxmo_hook_start.sh
# mail notification
MAILDIR=~/Maildir
inotifywait -m $MAILDIR/new -e moved_to |
while read path action file; do
FROM=$(grep '^From:' $path$file | cut -d' ' -f2- | cut -d'<' -f1)
SUBJECT=$(grep '^Subject' $path$file | cut -d' ' -f2-)
sxmo_notificationwrite.sh random "sxmo_terminal.sh mutt" $path$file "E-mail $FROM - $SUBJECT"
sxmo_vibrate 200 65535
done &