Posteo IMAP Imail in Mutt
De-Googling your life has become popular these days, and the more I read about it the more it made sense to move at least some of my information away from one of the globe’s largest companies. The biggest step for me (and most people) is to stop using gmail as your main email address. I’ve had my gmail address for close to a decade. People know it, many accounts are connected to it, and it has a huge backlog of email.
Despite that, I looked around, and decided to give Posteo a try. I’ve had the email account for about 6 months, and I like Posteo’s service. It’s about 1 euro per month for my account, and I could pay more for storage if I wanted. However, another part of the switch to Posteo was using neomutt (an updated version of the mutt email program).
The setup#
My neomutt setup is similar to most of the ones you’ll find online.
- Email goes to my Posteo account
- I sync a local version of my email folders to my desktop computer
- I can read, reply, archive, and delete emails on my computer
- The changes are sync’d back to Posteo using
It relies on a few pieces of software. Another important piece of information is that my contacts are also stored on Posteo.
- isync for grabbing new emails, and keeping my offline copy sync’d to the server
- neomutt for reading and writing emails
- vdirsyncer for keeping a local, sync’d copy of my contacts
- khard for cardDAV contact management
The has a a couple benefits. The main one being that I always have an offline backup of my entire email account. Assuming I have a recent sync of my email inbox, I also can read, reply, archive, and delete emails as mentioned before even if I don’t have internet access. Once I do have an internet connection again, the changes will be sync’d.
Email sync#
As mentioned above, I use isync to sync the Posteo IMAP folders to my local machine. Once the emails are sync’d I can interact with them as needed, and they are local files once on my machine so it doesn’t matter what the status of my connection is.
mbsyncrc file (~/.config/isync/.mbsyncrc)#
IMAPStore posteo-remote
Host posteo.de
Port 993
User [email protected]
# Uncomment one of the lines below depending on how the password is stored
#PassCmd "pass email/posteo"
#Pass secretpassword
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
MaildirStore posteo-local
Path ~/.local/mail/posteo/
Inbox ~/.local/mail/posteo/INBOX
Subfolders Verbatim
Channel posteo
Master :posteo-remote:
Slave :posteo-local:
Create Both
Expunge Both
Patterns *
SyncState *
Contacts Syncing#
Currently, my contacts are also stored in my Posteo account. This allows them to be sync’d to my iPhone/iPad pretty easily in addition to my computers. I use vdirsyncer to keep the contact information sync’d across devices, and I use khard to interact with and edit contact information on my computers. On my iPhone/iPad, I can edit the contacts using the built-in contact manager.
vdirsyncer config (~/.config/vdirsyncer/config)#
[general]
# Folder where vdirsyncer can store some metadata about each pair.
status_path = "~/.cache/vdirsyncer/status/"
# CardDAV
[pair my_contacts]
a = "my_contacts_local"
b = "my_contacts_remote"
collections = ["from a", "from b"]
# metadata = ["displayname"]
[storage my_contacts_local]
# Storage references actual data on a remote server or on the local disk.
type = "filesystem"
path = "~/.local/contacts/[email protected]"
fileext = ".vcf"
[storage my_contacts_remote]
type = "carddav"
url = "https://posteo.de:8443"
username = "[email protected]"
password = "secretpassword"
read_only = true
khard config (~/.config/khard/khard.conf)#
[addressbooks]
[[posteo]]
path = ~/.local/contacts/[email protected]/default
[general]
debug = no
default_action = list
editor = nvim, -i, NONE
merge_editor = vimdiff
[contact table]
#display names by first of last name
display = first_name
# show uid table column: yes/no
show_uids = yes
#sort by first or last name: first_name / last_name / formatted_name
sort = last_name
# localize dates: yes / no
localize_dates = yes
# set a comma seperated list of preferred phone number types in descending priority
preferred_phone_number_type = pref, cell, home
# set a csv list of preferred email address types in descending priority
preferred_email_address_type = pref, work, home
Reading and writing emails#
Lastly, neomutt is the program I use to read, write, reply to, and delete emails. It’s quick and works well even over ssh/mosh.
neomuttrc (~/.config/neomutt/neomuttrc)#
## Neomutt configuration file located at ~/.config/neomutt/neomuttrc
set from='[email protected]'
set realname='First Last'
set sendmail = "/usr/bin/msmtp -a posteo"
set sendmail_wait = 0
unset record
set header_cache='~/.cache/neomutt/headers'
set message_cachedir='~/.cache/neomutt/bodies'
set certificate_file='~/.cache/neomutt/certificates'
# My mailboxes
set folder ='~/.local/mail/posteo'
set spoolfile='+INBOX'
set postponed='+Drafts'
set record='+Sent'
set trash='+Trash'
mailboxes =INBOX =Archive =Sent =Trash =Drafts =Junk ='Mailing List' =Notes =Queue
# Personal preferences
set date_format="%y/%m/%d %I:%M%p"
set editor='nvim'
set sort=threads
set sort='reverse-date'
set forward_format = "Fwd: %s"
set include
# Setup khard for address book
set query_command= "khard email --parsable %s"
bind editor <Tab> complete-query
bind editor ^T complete
# Set key bindings
bind compose p postpone-message
bind index p recall-message
macro index G "!mbsync -a -c ~/.config/isync//.mbsyncrc^M" "Update through mbsync"
# Sidebar settings
set sidebar_visible=yes
set sidebar_width=20
set sidebar_short_path = yes
set sidebar_next_new_wrap = yes
set mail_check_stats
#set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?%S'
bind index,pager \Ck sidebar-prev
bind index,pager \Cj sidebar-next
bind index,pager \Co sidebar-open
bind index,pager \Cp sidebar-prev-new
bind index,pager \Cn sidebar-next-new
bind index,pager B sidebar-toggle-visible
# HTML settings
set mailcap_path = ~/.config/neomutt/mailcap
alternative_order text/plain text/enriched text/html
macro attach 'V' "<pipe-entry>iconv -c --to-code=UTF-8 > ~/.cache/neomutt/neomail.html<enter><shell-escape>$BROWSER ~/.cache/neomutt/neomail.html<enter>"
source colors.neomuttrc
colors.neomuttrc (~/.config/neomutt/colors.neomuttrc)#
# vim: filetype=neomuttrc
# Default index colors:
color index yellow default '.*'
color index_author red default '.*'
color index_number blue default
color index_subject cyan default '.*'
# For new mail:
color index brightyellow black "~N"
color index_author brightred black "~N"
color index_subject brightcyan black "~N"
# Header colors:
color header blue default ".*"
color header brightmagenta default "^(From)"
color header brightcyan default "^(Subject)"
color header brightwhite default "^(CC|BCC)"
mono bold bold
mono underline underline
mono indicator reverse
mono error bold
color normal default default
color indicator brightblack white
color sidebar_highlight red default
color sidebar_divider brightblack black
color sidebar_flagged red black
color sidebar_new green black
color normal brightyellow default
color error red default
color tilde black default
color message cyan default
color markers red white
color attachment white default
color search brightmagenta default
color status brightyellow black
color hdrdefault brightgreen default
color quoted green default
color quoted1 blue default
color quoted2 cyan default
color quoted3 yellow default
color quoted4 red default
color quoted5 brightred default
color signature brightgreen default
color bold black default
color underline black default
color normal default default
color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses
color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL
color body green default "\`[^\`]*\`" # Green text between ` and `
color body brightblue default "^# \.*" # Headings as bold blue
color body brightcyan default "^## \.*" # Subheadings as bold cyan
color body brightgreen default "^### \.*" # Subsubheadings as bold green
color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow
color body brightcyan default "[;:][-o][)/(|]" # emoticons
color body brightcyan default "[;:][)(|]" # emoticons
color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon?
color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon?
color body red default "(BAD signature)"
color body cyan default "(Good signature)"
color body brightblack default "^gpg: Good signature .*"
color body brightyellow default "^gpg: "
color body brightyellow red "^gpg: BAD signature from.*"
mono body bold "^gpg: Good signature"
mono body bold "^gpg: BAD signature from.*"
color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"
Future changes#
I’m pretty happy with this, and I don’t intend to changes things soon. However, I’d ultimately like to try keep my email archive on my personal computer and self-host my contacts.
Move my email archive offline#
What I eventually plan to do is have my “archive” offline on my main computer, delete emails from the server, and only keep new emails on the server. This is similar to what people used to do with their email accounts, but with Google, Microsoft, and others giving away so much storage for free, there’s little incentive to keep your emails to yourself.
Move contact syncing to Nextcloud#
I had mentioned in a previous post that I have a Quad Sata Pi setup with a software raid. I intend to run Nextcloud on that, and move my contact storage off Posteo.