aerc, mbsync, and postfix for maximum comfy offline email
source link: https://drewdevault.com/2021/05/17/aerc-with-mbsync-postfix.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
aerc, mbsync, and postfix for maximum comfy offline email May 17, 2021 on Drew DeVault's blog
I am the original author of the aerc mail client, though my official relationship with it today is marginal at best. I think that, with hindsight, I’ve come to understand that the “always online” approach of aerc’s IMAP implementation is less than ideal. The next email client (which will exist at some point!) will improve on this design, but, since it’s still my favorite email client despite these flaws, they will have to be worked around.
To this end, I have updated my personal aerc setup to take advantage of its Maildir support instead of having it use IMAP directly, then delegate IMAP to isync, a fork of mbsync, and SMTP to a local postfix instance. This brings a much-needed level of robustness to the setup, as my Maildirs are available offline or on a flaky connection, and postfix will handle queueing and redelivery of outgoing emails in similar conditions.1 This allows me to read and reply to email entirely offline, and have things sync up automatically when a connection becomes available.
The mbsync configuration format is kind of weird, but it is pretty flexible. My config file ended up looking like this:
IMAPAccount migadu
Host imap.migadu.com
User [email protected]
Pass [...]
SSLType IMAPS
MaildirStore local
Path ~/mail/
INBOX ~/mail/INBOX
SubFolders Verbatim
IMAPStore migadu
Account migadu
Channel primary
Far :migadu:
Near :local:
Patterns INBOX Archive Sent Junk
Expunge Both
The password can be configured to run an external command if you prefer to
integrate this with your keyring or password manager. I updated my aerc
accounts.conf
as well, which was straightforward:
[Drew]
source = maildir://~/mail
outgoing = /usr/sbin/sendmail
from = Drew DeVault <[email protected]>
copy-to = Sent
Running mbsync primary
at this point is enough to fetch these mailboxes from
IMAP and populate the local Maildirs, which can then be read with aerc. I set up
a simple cronjob to run this every minute to keep it up to date:
* * * * * chronic mbsync primary
chronic is a small utility from moreutils which converts reasonably behaved programs that return a nonzero exit status into the back-asswards behavior cron expects, which is that printing text to stdout means an error occurred and any status code, successful or not, is disregarded. You might want to tweak this further, perhaps by just directing all output into /dev/null instead, if you don’t want failed syncs to fill up your Unix mail spool.
mbsync is bidirectional (it is recommended to leave Expunge both
out of your
config until you’ve tested the setup), so deleting or archiving emails in aerc
will mirror the changes in IMAP as well.
Postfix is a lot more annoying to configure. You should assume that what I did
here isn’t going to work for you without additional changes and troubleshooting.
I started with an /etc/postfix/sasl_passwd
file like this:
[smtp.migadu.com]:465 [email protected]:password
The usual postmap /etc/postfix/sasl_passwd
applies here to create or update
the database file. Then I moved on to main.cf
:
# Allows localhost to relay mail
mynetworks = 127.0.0.0/8
# SMTP server to relay mail through
relayhost = [smtp.migadu.com]:465
# Auth options for SMTP relay
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = lmdb:/etc/postfix/sasl_passwd
# ¯\_(ツ)_/¯
smtp_tls_security_level = encrypt
smtp_tls_wrappermode = yes
smtp_use_tls = yes
smtp_sasl_security_options =
Good luck!
-
Postfix is probably overkill for this, but hey, it’s what I know. ↩︎
Have a comment on one of my posts? Start a discussion in my public inbox by sending an email to ~sircmpwn/[email protected] [mailing list etiquette]
Articles from blogs I read Generated by openring
What's cooking on Sourcehut? May 2021
Running a day late on this one — was travelling all day yesterday. We’ll also be moving the Mumble meeting to tomorrow, May 17th, this month. Thanks for your patience! Today, SourceHut has 22,588 users, 698 more since the last status update. Please offer our…
via Blogs on Sourcehut May 16, 2021Status update, April 2021
Hi all! Let’s start this status update with the biggest news this month: Sway 1.6 and wlroots 0.13.0 have been released! Alongside the user-visible improvements mentioned in the release notes and the numerous bug fixes, we’ve put a lot of effort into under-th…
via emersion April 15, 2021Site Redesign
Hey y’all! It’s been, gosh, what, ten years? I finally finished a total site redesign: all-new backend, HTML, CSS, modern image formats, etc. It’s finally readable on mobile now! There’s a lot of accumulated cruft in the database and filesystem–aphyr.com i…
via Aphyr: Posts March 28, 2021Recommend
-
27
As I recently changed my imap downloading tool choice from offlineimap to mbsync , and because the word on the street (where with “st...
-
34
As I recently changed my imap downloading tool choice from offlineimap to mbsync, and because the word on the street (where with “street” I mean “random discussion forums on the internet”) is that mbsync i...
-
31
trualias Copyright (c) 2019 Fred Morris, Tacoma WA. Apache 2.0 license. Trualias is a postfix tcp table that lets you hand out your email address to anyone and everyone but add a bit of math to protect yo...
-
8
Configuring aerc for git via email Configuring aerc for git via email April 20, 2020 on Drew DeVault's blog I use aerc as my email clie...
-
11
Creating Comfy FreeBSD Jails Using Standard Tools 2021-01-17freebsd Docker has stormed into softw...
-
7
Guide How To Refinish a Kids’ Rocking Chair 07 Oct Rocking chair refinishing is a...
-
6
Setting Up Gmail in Doom Emacs using mbsync and mu4e I can think of far better ways to spend a quiet Sunday afternoon than trying to get Doom Emacs to serve as an email client, but...
-
1
mailhelp (mutt + mbsync + fdm + msmtp on macOS for gmail) Config and dot files for mutt-based setup on macOS for gmail: mutt, mbsync, fdm, msmtp. mutt, mbsync and msmtp installed through brew, while fdm compiled from source. ...
-
3
Why It's A Bad Idea To Buy A Used Car SeatSkip to content Here at ComfyBummy, we fight every day to keep your kids safe a...
-
11
Maximum Email Size and How to Optimize ItMaximum Email Size and How to Optimize ItEmail sizes are fundamental for a few important reasons. One is security, and another is the performance of your email. This article covers, in brief,...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK