My personal mail setup

Christian Kruse

Requirements

While it may seem odd that I use Emacs to read and write my mail, it is just a logical consequence on my requirements. I need a MUA which is fast, can display mails in threads, integrates with Org mode, has a good search and lets me edit my mail in Emacs.

I think everybody can understand why I want a fast mail client; having to wait for mail is the least thing I want to do. I don’t need to explain that 😉 The same for a good search. But let me explain the other requirements.

Editing with Emacs is a nice to have, since as a Software developer I do text editing with Emacs most of the day. I am very good at editing text with Emacs, and it provides a lot of comfort.

Threading is different. Most FLOSS projects communicate via mailing lists. Discussing things in mailing lists works pretty well, you can take time to make a proper argument, you can prove-read your mail before sending and the barrier of entry is pretty darn low. But to be able to follow a discussion you absolutely have to be able to see to what mail the poster refers to; you have to be able to follow the discussion thread. This is what threading is for. If you have a mail thread with, lets say, 120 mails you will never be able to understand the whole discussion without the threading information.

The integration with Org mode is essential for me. Every time I get a todo or request or just want to answer that mail later I capture a Org mode todo containing a link to the mail itself. Thus I can hit C-c C-o on the link and the mail client opens with the mail. Without this feature I would totally forget most of my todos.

Notmuch reading a emacs-hackers mail

While most modern MUAs provide speed and a good search most of them totally fail in threading. Thunderbird can build proper threads, but Thunderbird sucks for various reasons. KMail can thread but I don’t want to use KDE. Evolution is just plain broken, it crashes several times a day. Mutt is ok, but it lacks of comfort. Claws is fine as long as your mail folders are not that big, it lacks of speed. And all of them fail when it comes to a tight Org mode integration. What’s left? Well, mail in Emacs.

Handling mail in Emacs

So while I initially thought that people reading mail with Emacs are crazy I became frustrated enough to give mail in Emacs a chance. To read mails with Emacs you basically have four choices:

  • Gnus, the default news reader for Emacs
  • Wanderlust, a MUA based on the traditional principles of a mail client
  • Mu with Mu4e, a mail client using Xapian via mu to index local maildirs
  • Notmuch, also a mail client based on Xapian indexing local mail dirs

I tried them all (and a few others).

Wanderlust

First I tried Wanderlust, it sounded the least complicated. But oh boy, nothing did I know. The documentation is horrible, I had to solve most of my problems with reading code and very old blog posts. And damn, this thing is so slow. I used it for just a week or something like that, I wasn’t able to keep it using.

Gnus

Next was Gnus. Gnus is cool when your mail folders are small or if you limit them to just a few mails. But searching is just, meh. It uses the IMAP search capabilities, which are, in my opinion, very limited. Also setting up Gnus is complicated, but you can find tons of documentation for that, the Practical guide to use Gnus with Gmail helped me a lot. You can still find my config in my Emacs repository. But the lack of a good search and the mediocre speed let me move the the next alternative.

Mu/Mu4e

Mu/Mu4e was a relief. It is ridiculously fast and the search capabilities just rock. It follows a mix of a traditional, folder based mail client and a search based mail client. I was totally happy with Mu4e for about a year, and I still would use it if I didn’t discover notmuch. It has a few problems, but none of them are major bummers. You can find my Mu4e configuration still in my Emacs repository.

Notmuch

Notmuch capturing a todo from an email

But then, via a blog post by a fellow Emacs user, I discovered notmuch. Notmuch is a purely tag and search based mail client using Xapian for indexing, similar to Mu4e. When Mu4e is blazing fast then notmuch is lightning fast. Opening a mail folder with 120k mails is done in under second; opening a mail with 30MB is just instant. In fact speed is the concept: the tagline is “Not much mail.” I’m still using it so I will explain this setup.

Basic concept

Handling email can basically be divided into four topics:

  • receiving mail
  • reading mail
  • composing mail
  • sending mail

Notmuch covers exactly one topic: reading mail. The other topics have to be covered by something else. Let’s start with sending mail since this is the easiest:

Sending mail

I send my mail using Msmtp. Msmtp is a SMTP client making it pretty darn easy to get mail to your mail server. It ships with three shell scripts: msmtp-enqueue.sh for putting mails into a queue, msmtp-listqueue.sh for listing the mail queue and msmtp-runqueue.sh for sending mails from the mail queue. I put them to ~/dev/mail/ and reference them in the mail tagging script and configured them as the sendmail command in my Emacs configuration. The Msmtp configuration file only contains the mail server and the authorization data:

# Set default values for all following accounts.
defaults
tls on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log

account Defunct
host host
from cjk@defunct.ch
tls_starttls off
port 465
auth on
user user
password password

Receiving mail

To receive mail I use OfflineIMAP. It syncs a local collection of maildirs to your IMAP mailbox and vice versa. There is isync/mbsync which is faster, but it can’t handle IMAP keep-alive and automatic resyncs, you have to run it via cronjobs. OfflineIMAP, on the other hand, has a daemon mode for IMAP idle and automatic resyncs. My configuration contains nothing special, it is plain simple:

[general]
# List of accounts to be synced, separated by a comma.
accounts = Defunct
ui = quiet

[Account Defunct]
# Identifier for the local repository; e.g. the maildir to be synced via IMAP.
localrepository = Defunct-local
# Identifier for the remote repository; i.e. the actual IMAP, usually non-local.
remoterepository = Defunct-remote
# Status cache. Default is plain, which eventually becomes huge and slow.
status_backend = sqlite
autorefresh = 0.5
quick = 10
newmail_hook = ~/dev/mail/update-mail
postsynchook = ~/dev/mail/update-mail


[Repository Defunct-local]
# Currently, offlineimap only supports maildir and IMAP for local repositories.
type = Maildir
# Where should the mail be placed?
localfolders = ~/Mail/Defunct

[Repository Defunct-remote]
# Remote repos can be IMAP or Gmail, the latter being a preconfigured IMAP.
type = IMAP
folderfilter = lambda foldername: foldername not in ["INBOX.spam"]
remotehost = host
remoteuser = user
remotepass = pass
cert_fingerprint  = fingerprint
idlefolders = ['INBOX']

I start OfflineIMAP via SystemD as described in the Arch wiki. To tag my mail for notmuch I use a small shell script:

basedir="`dirname $0`"
notmuch="/usr/bin/notmuch"
afew="/usr/bin/afew"

if [[ -f /usr/local/bin/notmuch ]]; then
  notmuch="/usr/local/bin/notmuch"
fi

sendmailcommand="$basedir/msmtp-runqueue.sh"

# Check connection status before sending mail
if ! ping -c1 www.google.com > /dev/null 2>&1; then
    # Ping could be firewalled ...
    # '-O -' will redirect the actual html to stdout and thus to /dev/null
    if ! wget -O - www.google.com > /dev/null 2>&1; then
        # Both tests failed. We are probably offline
        # (or google is offline, i.e. the end has come)
        exit 1;
    fi
fi

# We are online: So let's get mail going first
${sendmailcommand} 2>&1 >> ~/.msmtp.log

$afew -m -a

$notmuch new --quiet

$notmuch tag +inbox -- "folder:Defunct/INBOX and not tag:inbox"
$notmuch tag +sent -- "folder:Defunct/Sent and not tag:sent"

# postgresql lists
$notmuch tag +list +pg +hackers -- "folder:Defunct/Lists.pg.hackers and not tag:pg"
$notmuch tag +list +pg +www -- "folder:Defunct/Lists.pg.www and and not tag:pg"
$notmuch tag +list +pg +admin -- "folder:Defunct/Lists.pg.admin and not tag:pg"
$notmuch tag +list +pg +announce -- "folder:Defunct/Lists.pg.announce and not tag:pg"
$notmuch tag +list +pg +bugs -- "folder:Defunct/Lists.pg.bugs and not tag:pg"
$notmuch tag +list +pg +commit -- "folder:Defunct/Lists.pg.committers and not tag:pg"

# emacs lists
$notmuch tag +list +emacs +devel -- "folder:Defunct/Lists.emacs.devel and not tag:emacs"
$notmuch tag +list +emacs +org -- "folder:Defunct/Lists.emacs.org-mode and not tag:emacs"
$notmuch tag +list +emacs +help -- "folder:Defunct/Lists.emacs.help and not tag:emacs"

# CCC lists
$notmuch tag +list +ccc +warpzone -- "folder:Defunct/Lists.ccc.warpzone and not tag:ccc"
$notmuch tag +list +ccc +warpzone +intern -- "folder:Defunct/Lists.ccc.warpzone-intern and not tag:ccc"
$notmuch tag +list +ccc +chaos-west -- "folder:Defunct/Lists.ccc.chaos-west and not tag:ccc"
$notmuch tag +list +ccc +ch +basel +raif +intern -- "folder:Defunct/Lists.ccc.raif-intern and not tag:ccc"
$notmuch tag +list +ccc +ch +basel +raif -- "folder:Defunct/Lists.ccc.chaostreff and not tag:ccc"

# Phoenix lists
$notmuch tag +list +phoenix +talk -- "folder:Defunct/Lists.phoenix.talk and not tag:phoenix"
$notmuch tag +list +phoenix +talk -- "folder:Defunct/Lists.phoenix.core and not tag:phoenix"

# cforum
$notmuch tag +list +cforum -- "folder:Defunct/Lists.cforum and not tag:cforum"

# arch linux lists
$notmuch tag +list +arch +announce -- "folder:Defunct/Lists.arch.announce and not tag:arch"
$notmuch tag +list +arch +dev-public -- "folder:Defunct/Lists.arch.dev-public and not tag:arch"
$notmuch tag +list +arch +general -- "folder:Defunct/Lists.arch.general and not tag:arch"
$notmuch tag +list +arch +security -- "folder:Defunct/Lists.arch.security and not tag:arch"

# hackerspaces.org
$notmuch tag +list +hackerspaces +announce -- "to:announce-de@lists.hackerspaces.org and not tag:announce"
$notmuch tag +list +hackerspaces +discuss -- "to:discuss-de@lists.hackerspaces.org and not tag:discuss"

$notmuch tag +list +sailfish +devel -- "folder:Defunct/Lists.sailfish.devel and not tag:sailfish"

$notmuch tag -inbox +archive -- "folder:Defunct/Archiv and not tag:archive"

$notmuch tag -unread +trash -- 'folder:Defunct/Trash'

Using this script I don’t need to worry to keep my tags synced, it sets them based on folders.

Reading and composing mail

Notmuch answering an Emacs-hackers mail

Composing mail when using notmuch in Emacs is done via a derived form of the message mode and the Emacs MIME package. This is tightly coupled to the notmuch configuration, so I will explain the two topics together. First you need to configure notmuch; to do that just run notmuch in the command line. This will start a wizard asking you for the configuration options. Next index the mail with notmuch new - this builds the mail index for Xapian. Now you have to tag your mails, if you look at the script above you get the idea how this is done.

Now that this is out of the way lets get started with the Emacs configuration:

(setq notmuch-search-oldest-first nil
      message-sendmail-envelope-from 'header
      mail-specify-envelope-from 'header
      mail-envelope-from 'header
      notmuch-show-all-multipart/alternative-parts nil
      mime-edit-pgp-signers '("C84EF897")
      mime-edit-pgp-encrypt-to-self t
      mml2015-encrypt-to-self t
      mml2015-sign-with-sender t
      notmuch-crypto-process-mime t
      message-send-mail-function 'message-send-mail-with-sendmail
      sendmail-program "~/dev/mail/msmtp-enqueue.sh"
      message-sendmail-f-is-evil nil
      mail-interactive t
      user-full-name "Christian Kruse"
      user-mail-address "cjk@defunct.ch"
      message-kill-buffer-on-exit t
      mail-user-agent 'message-user-agent
      notmuch-always-prompt-for-sender t
      notmuch-fcc-dirs '((".*" . "Defunct/Sent"))
      notmuch-show-indent-messages-width 4
      notmuch-saved-searches '((:name "inbox" :query "tag:inbox" :key "i")
                               (:name "CForum" :query "folder:Defunct/Lists.cforum")
                               (:name "Warpzone" :query "tag:list and tag:warpzone and not tag:intern")
                               (:name "Warpzone Unread" :query "tag:list and tag:warpzone and not tag:intern and tag:unread")
                               (:name "Warpzone intern" :query "tag:list and tag:warpzone and tag:intern")
                               (:name "Warpzone intern Unread" :query "tag:list and tag:warpzone and tag:intern and tag:unread")
                               (:name "PostgreSQL" :query "tag:pg and tag:list")
                               (:name "PostgreSQL Unread" :query "tag:pg and tag:list and tag:unread")
                               (:name "Phoenix" :query "tag:phoenix and tag:list")
                               (:name "Phoenix Unread" :query "tag:phoenix and tag:list and tag:unread")
                               (:name "Emacs:Devel" :query "tag:emacs and tag:devel and tag:list")
                               (:name "Emacs:Devel Unread" :query "tag:emacs and tag:devel and tag:list and tag:unread")
                               (:name "Emacs:Help" :query "tag:emacs and tag:help and tag:list")
                               (:name "Emacs:Help Unread" :query "tag:emacs and tag:help and tag:list and tag:unread")
                               (:name "Emacs:Org Unread" :query "tag:emacs and tag:org and tag:list and tag:unread")
                               (:name "unread" :query "tag:unread" :key "u")
                               (:name "flagged" :query "tag:flagged" :key "f")
                               (:name "sent" :query "tag:sent" :key "t")
                               (:name "drafts" :query "tag:draft" :key "d")
                               (:name "all mail" :query "*" :key "a")))
  • notmuch-search-oldest-first defines the sort order: I like the newest messages first.
  • message-sendmail-envelope-from and mail-specify-envelope-from tell the message mode, that it should derive the envelope address from the From header of the mail - I use this to change my sender address from time to time, e.g. for registration mails when I want to use a specific mail address.
  • notmuch-show-all-multipart/alternative-parts defines that notmuch should not show all alternative parts of the mail; this is often just some junk I’m not interested in.
  • mime-edit-pgp-signers defines the standard keys for signing mails.
  • mime-edit-pgp-encrypt-to-self defines that I want a copy encrypted with my public key for encrypted mails; thus I can read this mail again later. Same for mml2015-encrypt-to-self just for a different Emacs mode.
  • mml2015-sign-with-sender says that mml should find the key by the sender address.
  • notmuch-crypto-process-mime says notmuch that it should decrypt encryted messages and check mail signatures.
  • message-send-mail-function defines the mail sending function, a wrapper around sendmail in this case. sendmail-program defines the sendmail program and message-sendmail-f-is-evil tells message mode that the -f flag for sendmail is not supported (since we use notmuch-enqueue.sh as a sendmail replacement).
  • mail-interactive tells Emacs to report sending errors back to me and not let the MTA take care of this.
  • user-full-name and user-mail-address define my name and mail address.
  • message-kill-buffer-on-exit tells message mode to kill message editing buffers when the mail has been sent or sending has been canceled.
  • mail-user-agent tells Emacs which mail delivery package I want to use. message-user-agent in our case.
  • notmuch-always-prompt-for-sender tells notmuch to ask me for the sender address when composing or forwarding a message.
  • notmuch-fcc-dirs is a ruleset for the sent folder; in this case it is just my sent folder of my single account.
  • notmuch-show-indent-messages-width defines the indention width for threading.
  • notmuch-saved-searches contains standard searches.

For Org mode integration we load org-notmuch:

(require 'org-notmuch)

Now lets define some shortcuts and we’re done:

(define-key notmuch-show-mode-map "\C-c\C-o" 'browse-url-at-point)

(define-key notmuch-search-mode-map "g"
  'notmuch-poll-and-refresh-this-buffer)
(define-key notmuch-hello-mode-map "g"
  'notmuch-poll-and-refresh-this-buffer)

(define-key notmuch-search-mode-map "d"
  (lambda ()
    "toggle deleted tag for thread"
    (interactive)
    (if (member "deleted" (notmuch-search-get-tags))
        (notmuch-search-tag '("-deleted"))
      (notmuch-search-tag '("+deleted" "-inbox" "-unread")))))

(define-key notmuch-search-mode-map "!"
  (lambda ()
    "toggle unread tag for thread"
    (interactive)
    (if (member "unread" (notmuch-search-get-tags))
        (notmuch-search-tag '("-unread"))
      (notmuch-search-tag '("+unread")))))


(define-key notmuch-show-mode-map "d"
  (lambda ()
    "toggle deleted tag for message"
    (interactive)
    (if (member "deleted" (notmuch-show-get-tags))
        (notmuch-show-tag '("-deleted"))
      (notmuch-show-tag '("+deleted" "-inbox" "-unread")))))



(define-key notmuch-search-mode-map "a"
  (lambda ()
    "toggle archive"
    (interactive)
    (if (member "archive" (notmuch-search-get-tags))
        (notmuch-search-tag '("-archive"))
      (notmuch-search-tag '("+archive" "-inbox" "-unread")))))


(define-key notmuch-show-mode-map "a"
  (lambda ()
    "toggle archive"
    (interactive)
    (if (member "archive" (notmuch-show-get-tags))
        (notmuch-show-tag '("-archive"))
      (notmuch-show-tag '("+archive" "-inbox" "-unread")))))


(define-key notmuch-hello-mode-map "i"
  (lambda ()
    (interactive)
    (notmuch-hello-search "tag:inbox")))

(define-key notmuch-hello-mode-map "u"
  (lambda ()
    (interactive)
    (notmuch-hello-search "tag:unread")))

(define-key notmuch-hello-mode-map "a"
  (lambda ()
    (interactive)
    (notmuch-hello-search "tag:archive")))

These should be self-explanatory.

This is my basic email configuration. What’s left to do? Well, two things: I have a setup to move mails out of my inbox using afew and notifications for new mails. For notifications I don’t have a working implementation since this is very low in my priority. But I can explain my afew setup to you:

Moving mails with afew

I use afew to move mails to different folders, so that other MUAs I’m using don’t show me just a very long list of mails. The configuration is very basic, I just use the „move mails” feature. My ~/.config/afew/config is as follows:

[MailMover]
folders = Defunct/INBOX

# rules
Defunct/INBOX = 'tag:archive':Defunct/Archiv 'tag:cforum':Defunct/Lists.cforum 'tag:deleted':Defunct/Trash

It basically says: use the MailMover plugin and look in Defunct/INBOX; in the inbox move mails found by the defined searches to the specific folders. I call afew in my update-mails script above.

That’s it. This is my mail setup. Do you have questions? Are you missing something? Drop me a mail!

What others had to say…

Archaic text based email clients rock!

shrysr wrote at https://s.ragavan.co/2019/07/archaic-text-based-email-clients-rock/

Table of ContentsTLDR – for the busy folksGoals:Summary:Multiple email accounts. Lack of a unified interface.Creating sync channels via mbsyncText based email client! Speed + simplicityWhy mu4e rocks – the perksQuirksMultiple levels of filters are still necessary.TakeawaysLinks and References This dev.to blog post inspired me to complete this languishing draft of my current email setup, and the benefits I’ve gained from using a text based email client in Emacs. Hope you find it entertaining. In any case, the links and reference section will certainly prove useful. TLDR – for the busy folksGoals:Unification of email accounts while preserving separate individual components.Local backup of email.Potential to extend system to a personal serverEmail access from Emacs !Hopefully improve overall productivity with reduced context switching.Summary:Started with 2 Gmail accounts and 1 MSN account.Switched to a paid account with Fastmail.Used Fastmail’s tools to transfer email from both Gmail and MSN accounts.Setup forwarding for all new emails from to Fastmail.Decided between retaining copies of emails in Gmail/MSN or deleting them once forwarded.Used customised settings in mu4e to manage Email from within Emacs.Occasionally rely on web browser / iOS app. Fastmail’s interface is clean and very fast.Goals Achieved !! Live with the quirks and enjoy the perks. Look at the Links and References section for almost all the resources I relied on. A portion of my mu4e configuration is available on my website. The personal filters and configuration are placed in an encrypted file. My mbsync configuration is posted as a public gist. Multiple email accounts. Lack of a unified interface. Some years back, I found that I had 2 Gmail accounts, and an MSN account. I discarded age old Yahoo and rediffmail accounts which were luckily not used much (and God knows how many more I made as a kid). Gmail’s interface felt just about tolerable, but inconvenient. The idea of viewing ads tailored to the content of emails had become disconcerting. Their Inbox app was interesting, but did not work smooth enough. MSN’s web interace and apps always felt cumbersome, though updates over the years, this has improved significantly. Useful emails could be email digests that contain a wealth of links, discussions, articles and information. Or perhaps email digests of product and technology news that are useful to retain as an archive of reference. It would be nice to be able to process these links in a systematic manner, and have them available with a fast search system that is also integrated with a task management system. My solution was to switch to forwarding all my emails to a single Fastmail account. It’s been an excellent experience over 2+ years.1,2Creating sync channels via mbsync My mbsync configuration is posted as a public gist. It is reasonably self explanatory, and shows how separate channels were made grouping together folders, by specifying a pattern. This took some time, but was finally very satisfying to know as a fine grained control technique. I started out using offlineimap. I found mbsync to be significantly faster. Text based email client! Speed + simplicity Imagine being engrossed with your code or engineering notebook and the need for shooting off an urgent brief email arises. What if this could be done with a few key-presses on an email client, right from the terminal or the code editor that you are already engrossed in? How about adding an email as a task in your organiser with a deadline / planned date? What if I had the option to setup separate channels of mail transfer, such that I can sync the inbox or a custom group of folders alone when I am pressed for bandwidth or space? Practical solutions will need to cater to a lot more situations. The good news is: usually anything you need is possible (or already implemented) using Emacs. I use mu4e, which uses the indexer mu as it’s back-end. There are other popular options like notmuch and mutt. I have briefly experimented with mutt, which has a fast email search capability, but has to be coupled with another front-end to be used within Emacs or elsewhere. The philosophy and system behind notmuch (leveraging the Gmail tag based approach) differ from mu4e. Over a few years of using this system, I have found that text and terminal based email clients offer a speed and integrity that is extremely pleasing. Why mu4e rocks – the perks The ability to create custom search filters that can be accessed with easy shortcuts. An example to demonstrate (setq mu4e-bookmarks `( ,(make-mu4e-bookmark :name "Unread messages" :query "flag:unread AND NOT flag:trashed" :key ?u) ,(make-mu4e-bookmark :name "Today's messages" :query "date:today..now" :key ?t) ,(make-mu4e-bookmark :name "Last 7 days" :query "date:7d..now" :key ?w) ,(make-mu4e-bookmark :name "Messages with images" :query "mime:image/*" :key ?p) ,(make-mu4e-bookmark :name "Finance News" :query (concat "from:etnotifications@indiatimes.com OR " "from:newsletters@valueresearchonline.net" "from:value research") :key ?f) ,(make-mu4e-bookmark :name "Science and Technology" :query (concat "from:googlealerts-noreply@google.com OR " "from:reply@email.engineering360.com OR " "from:memagazine@asme.org" "from:action@ifttt.com" "from:digitaleditions@techbriefs.info") :key ?S) )) This is how it looks: Complete keyboard based control, and using it with Emacs means the ability to compose email from anywhere and build all kinds of workflows. Examples: Hit Control+x and m (C-x m) in Emacs parlance, and I have a compose window open.There are built-in workflows and functions in starter-kits like Scimax, which enable you to email an org-heading or buffer directly into an email, with the formatting usually preserved, and as intended. I often use yasnippet to insert links to standard attachments like my resume. This essentially means being able to attach files with a 1-2 key strokes. While Mu4e may be a programmatic solution with no pleasing GUI – it allows one to search a large number of emails with glorious ease. This is particularly more effective on a SSD drive, rather than the conventional Hard disk. One has to experience the above to know the dramatic impact it makes in getting closer in speed to your thoughts, using a customisable system. Emails can be easily captured or added as tasks into Org mode documents as a part of task and project management. Using the mu4e and mbsync, I’ve devised a ‘sane inbox’ which is bereft of the noise, like annoying digests, social media updates and so on. The idea was to dedicate focused blocks to rapidly process email, all within Emacs. I have tried using Todoist extensively in the past, along with their integration with Gmail. This approach is a reasonable solution, if one is open to using different applications. Quirksmu4e is a text based email interface. It can be set such that the rendered HTML is displayed in the mu4e-view buffer for each email, which enables graphics and pictures (if any). However, the render is not perfect at all times. The HTML parsing engine can be specified. Thus, heavy HTML emails are unlikely to render correctly, to the extent of being a nuisance. Such emails can be viewed in the browser of your choice with merely 2 key presses, ‘a’ and then ‘v’, with cursor in the body of the email. This could be Firefox, or w3m or any other browser of your choice.3 Email syncing frequency is set in mu4e. This update process takes a few seconds, and it is not as seamless as a web app. Notifications for new email can be configured on the mode line or through pop-ups in Emacs. However, the experience with working synced emails is good. Multiple levels of filters are still necessary. Situations where I do not have access to Emacs will need me to use the iOS app or the web interface. Therefore the inbox in the web interface here cannot be ‘insane’. Therefore a higher level of filters are implemented in Fastmail itself. For example all Linked in group and job updates have their own folders. These folders are all subfolders of the Archive. They never reach the inbox at all. These emails often remain unread, or if necessary, I can focus on bunches of them at a time. By grouping all such incoming mails into subfolders within the Archive folder, I can use a single channel for all the relatively unimportant mail. TakeawaysUsing an ‘archaic’ text based email client (mu4e) has significantly boosted the speed with which I can handle my emails and focus on tasks. The simple interface and speed enables better focus.While there are many articles and plenty of guidance on this topic, it takes time and patience to get this working the way you need it to. However, once it is setup, it does become rather comfortable to use.Context switching is expensive on the brain and dents productivity.Integrating email with time and project management is important. mu4e integrates well with Org mode. Beyond tasks, it is also a good reference, and I can easily attach notes, summaries etc to these emails.Links and References These are the links and references I’ve used in setting up and troubleshooting my email setup. These could be organized better, and some links may be repeated. All put together, these should give you all you need to get hooked up! Some of the links have additional comments, and many are tagged with dates, as a reference to when I collected the link. Sometimes, this is fun to reflect on! A Complete Guide to Email in Emacs using Mu and Mu4e, <2017-03-08 Wed 10:04>Reading IMAP Mail in Emacs on OSX | Adolfo Villafiorita, <2016-11-27 Sun 08:17>[ ] Excellent link talking about mu4e and notifications Handling Email with Emacs – malb::blog, <2016-08-01 Mon 18:37>Which email client (mu4e, Mutt, notmuch, Gnus) do you use inside Emacs, and why? : emacs<2016-05-31 Tue 07:32>emacs-fu: introducing mu4e, an e-mail client for emacs – Emacs and mu4e stuff <2016-04-20 Wed 13:02>Emacs as email client with offlineimap and mu4e on OS X / KG / Hacks. Thoughts. Writings. – nice blog related to Emacs and linux <2016-04-21 Thu 22:44>EOS: Mail (Email) Module – explaining multiple email setup in mu4e <2016-04-27 Wed 07:56>The Ultimate Emailing Agent with Mu4e and Emacs – Emacs, Arduino, Raspberry Pi, Linux and Programming etc, <2016-08-17 Wed 13:19>Varun B Patil | EOM a.k.a End of Mail a.k.a Emacs + offlineimap + mu4e – multiple accounts <2016-04-19 Tue 12:19>Master your inbox with mu4e and org-mode | Pragmatic Emacs<2016-03-26 Sat 14:56>notmuch – email setup My personal mail setup — Articles — WWWTech<2017-06-13 Tue 16:09>Search-oriented tools for Unix-style mail | Mark J. Nelson, <2017-05-10 Wed 16:29>interesting comparison of mu and notmuch, going beyond superficial differences, but not too much depth either.Mutt with multiple accounts, mbsync, notmuch, GPG and sub-minute updates | French to English translator, <2017-04-28 Fri 07:19>interesting link, author profile and content available on-line.Assorted Nerdery – Notmuch of a mail setup Part 2 – notmuch and Emacs, <2017-04-27 Thu 18:41>Mutt, mu4e and notmuch links bash – Send Html page As Email using “mutt” – Stack OverflowReading html email with muttPrefer plain text format over HTML in muttUsing emacs and notmuch as a mail client – Foivos . Zakkak . netHelp with mu4e multiple accounts : emacsUsing Mutt, OfflineIMAP and Notmuch to wrangle your inbox. : linux<2016-06-16 Thu 15:23>A year with Notmuch mail {LWN.net}<2018-04-17 Tue 01:21>mu4e specific Links <2016-04-19 Tue 21:48>Mu4e 0.9.16 user manual: Gmail configurationmu4e tutorials – Google SearchTutorial: email in Emacs with mu4e and IMAP+SSL : emacsmu4e tutorials | Pragmatic EmacsDrowning in Email; mu4e to the Rescue.Emacs & the obsessive email mongerer | Moved by Freedom – Powered by StandardsMu4e + nullmailer – Google GroupsLeaving Gmail Behind « null programview html mails in mu4e – Google SearchMu4e 0.9.16 user manual: Reading messagesIn mu4e, is this how your HTML-heavy emails render? : emacsVarun B Patil | EOM a.k.a End of Mail a.k.a Emacs + offlineimap + mu4eMu4e 0.9.16 user manual: Marking messageschange the date column format in mu4e – Google SearchMu4e 0.9.16 user manual: HV Overviewincrease column size in mu4e – Google SearchMu4e 0.9.16 user manual: HV Custom headersmu4e-manual-0.9.9.pdfdo mu4e folders sync with gmail folders – Google Searchmu4e Send mail with custom SMTP and archive in Gmail “Sent” folder : emacsUsing mu4e · Brool are maildir folders synced back to gmail ? – Google SearchSome real use casesAboutBacking up Gmail messages with offlineimapnotmuch email versus mu4e – Google SearchWhich email client (mu4e, Mutt, notmuch, Gnus) do you use inside Emacs, and why? : emacsA Followup on Leaving Gmail | IrrealSup?Mutt + Gmail + OfflineimapMigrating from offlineimap to mbsync for mu4e | Pragmatic EmacsFootnotes: 1 Fastmail allows for a variety of interesting features like aliases, easy email transfer (from a different email provider like Gmail or MSN), responsive technical support, and many more aspects, and much more. They have their own implementation of the IMAP protocol, called JMAP, which is significantly faster. 2 While there are many advantages in Gmail and many swear by it’s search capabilities – it is worth noting that Fastmail’s ad-free interface and search just feels a lot quicker than Gmail, and I can find my way around the settings better than I used to with Gmail. 3 You may be surprised to see the ease in browsing a good number of websites on a text based web browser. Besides the added advantage of being within Emacs – a surprising number of websites can be viewed functionally on w3m. It works fine for quick searches on Google (which like anything else, can be done within a few key strokes in Emacs).
Archaic text based email clients rock!

shrysr wrote at http://s.ragavan.co/2019/07/archaic-text-based-email-clients-rock/

Table of ContentsTLDR – for the busy folksGoals:Summary:Multiple email accounts. Lack of a unified interface.Creating sync channels via mbsyncText based email client! Speed + simplicityWhy mu4e rocks – the perksQuirksMultiple levels of filters are still necessary.TakeawaysLinks and ReferencesThis dev.to blog post inspired me to complete this languishing draft of my current email setup, and the benefits I’ve gained from using a text based email client in Emacs.Hope you find it entertaining. In any case, the links and reference section will certainly prove useful.TLDR – for the busy folksGoals:Unification of email accounts while preserving separate individual components.Local backup of email.Potential to extend system to a personal serverEmail access from Emacs !Hopefully improve overall productivity with reduced context switching.Summary:Started with 2 Gmail accounts and 1 MSN account.Switched to a paid account with Fastmail.Used Fastmail’s tools to transfer email from both Gmail and MSN accounts.Setup forwarding for all new emails from to Fastmail.Decided between retaining copies of emails in Gmail/MSN or deleting them once forwarded.Used customised settings in mu4e to manage Email from within Emacs.Occasionally rely on web browser / iOS app. Fastmail’s interface is clean and very fast.Goals Achieved !! Live with the quirks and enjoy the perks.Look at the Links and References section for almost all the resources I relied on.A portion of my mu4e configuration is available on my website. The personal filters and configuration are placed in an encrypted file.My mbsync configuration is posted as a public gist.Multiple email accounts. Lack of a unified interface.Some years back, I found that I had 2 Gmail accounts, and an MSN account. I discarded age old Yahoo and rediffmail accounts which were luckily not used much (and God knows how many more I made as a kid).Gmail’s interface felt just about tolerable, but inconvenient. The idea of viewing ads tailored to the content of emails had become disconcerting. Their Inbox app was interesting, but did not work smooth enough. MSN’s web interace and apps always felt cumbersome, though updates over the years, this has improved significantly.Useful emails could be email digests that contain a wealth of links, discussions, articles and information. Or perhaps email digests of product and technology news that are useful to retain as an archive of reference.It would be nice to be able to process these links in a systematic manner, and have them available with a fast search system that is also integrated with a task management system.My solution was to switch to forwarding all my emails to a single Fastmail account. It’s been an excellent experience over 2+ years.1,2Creating sync channels via mbsyncMy mbsync configuration is posted as a public gist. It is reasonably self explanatory, and shows how separate channels were made grouping together folders, by specifying a pattern. This took some time, but was finally very satisfying to know as a fine grained control technique.I started out using offlineimap. I found mbsync to be significantly faster.Text based email client! Speed + simplicityImagine being engrossed with your code or engineering notebook and the need for shooting off an urgent brief email arises. What if this could be done with a few key-presses on an email client, right from the terminal or the code editor that you are already engrossed in?How about adding an email as a task in your organiser with a deadline / planned date?What if I had the option to setup separate channels of mail transfer, such that I can sync the inbox or a custom group of folders alone when I am pressed for bandwidth or space?Practical solutions will need to cater to a lot more situations.The good news is: usually anything you need is possible (or already implemented) using Emacs.I use mu4e, which uses the indexer mu as it’s back-end. There are other popular options like notmuch and mutt. I have briefly experimented with mutt, which has a fast email search capability, but has to be coupled with another front-end to be used within Emacs or elsewhere. The philosophy and system behind notmuch (leveraging the Gmail tag based approach) differ from mu4e.Over a few years of using this system, I have found that text and terminal based email clients offer a speed and integrity that is extremely pleasing.Why mu4e rocks – the perksThe ability to create custom search filters that can be accessed with easy shortcuts. An example to demonstrate (setq mu4e-bookmarks `( ,(make-mu4e-bookmark :name "Unread messages" :query "flag:unread AND NOT flag:trashed" :key ?u) ,(make-mu4e-bookmark :name "Today's messages" :query "date:today..now" :key ?t) ,(make-mu4e-bookmark :name "Last 7 days" :query "date:7d..now" :key ?w) ,(make-mu4e-bookmark :name "Messages with images" :query "mime:image/*" :key ?p) ,(make-mu4e-bookmark :name "Finance News" :query (concat "from:etnotifications@indiatimes.com OR " "from:newsletters@valueresearchonline.net" "from:value research") :key ?f) ,(make-mu4e-bookmark :name "Science and Technology" :query (concat "from:googlealerts-noreply@google.com OR " "from:reply@email.engineering360.com OR " "from:memagazine@asme.org" "from:action@ifttt.com" "from:digitaleditions@techbriefs.info") :key ?S) )) This is how it looks: Complete keyboard based control, and using it with Emacs means the ability to compose email from anywhere and build all kinds of workflows. Examples:Hit Control+x and m (C-x m) in Emacs parlance, and I have a compose window open.There are built-in workflows and functions in starter-kits like Scimax, which enable you to email an org-heading or buffer directly into an email, with the formatting usually preserved, and as intended.I often use yasnippet to insert links to standard attachments like my resume. This essentially means being able to attach files with a 1-2 key strokes.While Mu4e may be a programmatic solution with no pleasing GUI – it allows one to search a large number of emails with glorious ease. This is particularly more effective on a SSD drive, rather than the conventional Hard disk.One has to experience the above to know the dramatic impact it makes in getting closer in speed to your thoughts, using a customisable system. Emails can be easily captured or added as tasks into Org mode documents as a part of task and project management.Using the mu4e and mbsync, I’ve devised a ‘sane inbox’ which is bereft of the noise, like annoying digests, social media updates and so on. The idea was to dedicate focused blocks to rapidly process email, all within Emacs.I have tried using Todoist extensively in the past, along with their integration with Gmail. This approach is a reasonable solution, if one is open to using different applications.Quirksmu4e is a text based email interface. It can be set such that the rendered HTML is displayed in the mu4e-view buffer for each email, which enables graphics and pictures (if any). However, the render is not perfect at all times. The HTML parsing engine can be specified. Thus, heavy HTML emails are unlikely to render correctly, to the extent of being a nuisance.Such emails can be viewed in the browser of your choice with merely 2 key presses, ‘a’ and then ‘v’, with cursor in the body of the email. This could be Firefox, or w3m or any other browser of your choice.3Email syncing frequency is set in mu4e. This update process takes a few seconds, and it is not as seamless as a web app. Notifications for new email can be configured on the mode line or through pop-ups in Emacs. However, the experience with working synced emails is good.Multiple levels of filters are still necessary.Situations where I do not have access to Emacs will need me to use the iOS app or the web interface. Therefore the inbox in the web interface here cannot be ‘insane’. Therefore a higher level of filters are implemented in Fastmail itself.For example all Linked in group and job updates have their own folders. These folders are all subfolders of the Archive. They never reach the inbox at all. These emails often remain unread, or if necessary, I can focus on bunches of them at a time.By grouping all such incoming mails into subfolders within the Archive folder, I can use a single channel for all the relatively unimportant mail.TakeawaysUsing an ‘archaic’ text based email client (mu4e) has significantly boosted the speed with which I can handle my emails and focus on tasks. The simple interface and speed enables better focus.While there are many articles and plenty of guidance on this topic, it takes time and patience to get this working the way you need it to. However, once it is setup, it does become rather comfortable to use.Context switching is expensive on the brain and dents productivity.Integrating email with time and project management is important. mu4e integrates well with Org mode. Beyond tasks, it is also a good reference, and I can easily attach notes, summaries etc to these emails.Links and ReferencesThese are the links and references I’ve used in setting up and troubleshooting my email setup.These could be organized better, and some links may be repeated. All put together, these should give you all you need to get hooked up!Some of the links have additional comments, and many are tagged with dates, as a reference to when I collected the link. Sometimes, this is fun to reflect on!A Complete Guide to Email in Emacs using Mu and Mu4e, <2017-03-08 Wed 10:04>Reading IMAP Mail in Emacs on OSX | Adolfo Villafiorita, <2016-11-27 Sun 08:17>[ ] Excellent link talking about mu4e and notifications Handling Email with Emacs – malb::blog, <2016-08-01 Mon 18:37>Which email client (mu4e, Mutt, notmuch, Gnus) do you use inside Emacs, and why? : emacs<2016-05-31 Tue 07:32>emacs-fu: introducing mu4e, an e-mail client for emacs – Emacs and mu4e stuff <2016-04-20 Wed 13:02>Emacs as email client with offlineimap and mu4e on OS X / KG / Hacks. Thoughts. Writings. – nice blog related to Emacs and linux <2016-04-21 Thu 22:44>EOS: Mail (Email) Module – explaining multiple email setup in mu4e <2016-04-27 Wed 07:56>The Ultimate Emailing Agent with Mu4e and Emacs – Emacs, Arduino, Raspberry Pi, Linux and Programming etc, <2016-08-17 Wed 13:19>Varun B Patil | EOM a.k.a End of Mail a.k.a Emacs + offlineimap + mu4e – multiple accounts <2016-04-19 Tue 12:19>Master your inbox with mu4e and org-mode | Pragmatic Emacs<2016-03-26 Sat 14:56>notmuch – email setup My personal mail setup — Articles — WWWTech<2017-06-13 Tue 16:09>Search-oriented tools for Unix-style mail | Mark J. Nelson, <2017-05-10 Wed 16:29>interesting comparison of mu and notmuch, going beyond superficial differences, but not too much depth either.Mutt with multiple accounts, mbsync, notmuch, GPG and sub-minute updates | French to English translator, <2017-04-28 Fri 07:19>interesting link, author profile and content available on-line.Assorted Nerdery – Notmuch of a mail setup Part 2 – notmuch and Emacs, <2017-04-27 Thu 18:41>Mutt, mu4e and notmuch links bash – Send Html page As Email using “mutt” – Stack OverflowReading html email with muttPrefer plain text format over HTML in muttUsing emacs and notmuch as a mail client – Foivos . Zakkak . netHelp with mu4e multiple accounts : emacsUsing Mutt, OfflineIMAP and Notmuch to wrangle your inbox. : linux<2016-06-16 Thu 15:23>A year with Notmuch mail {LWN.net}<2018-04-17 Tue 01:21>mu4e specific Links <2016-04-19 Tue 21:48>Mu4e 0.9.16 user manual: Gmail configurationmu4e tutorials – Google SearchTutorial: email in Emacs with mu4e and IMAP+SSL : emacsmu4e tutorials | Pragmatic EmacsDrowning in Email; mu4e to the Rescue.Emacs & the obsessive email mongerer | Moved by Freedom – Powered by StandardsMu4e + nullmailer – Google GroupsLeaving Gmail Behind « null programview html mails in mu4e – Google SearchMu4e 0.9.16 user manual: Reading messagesIn mu4e, is this how your HTML-heavy emails render? : emacsVarun B Patil | EOM a.k.a End of Mail a.k.a Emacs + offlineimap + mu4eMu4e 0.9.16 user manual: Marking messageschange the date column format in mu4e – Google SearchMu4e 0.9.16 user manual: HV Overviewincrease column size in mu4e – Google SearchMu4e 0.9.16 user manual: HV Custom headersmu4e-manual-0.9.9.pdfdo mu4e folders sync with gmail folders – Google Searchmu4e Send mail with custom SMTP and archive in Gmail “Sent” folder : emacsUsing mu4e · Brool are maildir folders synced back to gmail ? – Google SearchSome real use casesAboutBacking up Gmail messages with offlineimapnotmuch email versus mu4e – Google SearchWhich email client (mu4e, Mutt, notmuch, Gnus) do you use inside Emacs, and why? : emacsA Followup on Leaving Gmail | IrrealSup?Mutt + Gmail + OfflineimapMigrating from offlineimap to mbsync for mu4e | Pragmatic EmacsFootnotes:1Fastmail allows for a variety of interesting features like aliases, easy email transfer (from a different email provider like Gmail or MSN), responsive technical support, and many more aspects, and much more. They have their own implementation of the IMAP protocol, called JMAP, which is significantly faster.2While there are many advantages in Gmail and many swear by it’s search capabilities – it is worth noting that Fastmail’s ad-free interface and search just feels a lot quicker than Gmail, and I can find my way around the settings better than I used to with Gmail.3You may be surprised to see the ease in browsing a good number of websites on a text based web browser. Besides the added advantage of being within Emacs – a surprising number of websites can be viewed functionally on w3m. It works fine for quick searches on Google (which like anything else, can be done within a few key strokes in Emacs).

Reposts and likes

  • Jeena
  • Kenneth Geisshirt