Mu4e is a frontend for mu, an email analyzer which sits on top of a Maildir which gets updated with the mbsync command from isync . It has a lot of neat features, but I guess my favorite ones are:

the search query feature rendering an HTML email in the browser

Due to mu sitting on top of a maildir, I need to tell mu4e where said maildir is, and point it the trash, archive, and sent folders as well as the refresh command and how frequently I want my emails to be refreshed.

( setq mu4e-maildir "~/.mail" mu4e-trash-folder "/Trash" mu4e-refile-folder "/Archive" mu4e-sent-folder "/Sent" mu4e-drafts-folder "/Drafts" mu4e-get-mail-command "mbsync -a" mu4e-update-interval 60)

The following also allows me to automatically include my signature in my Emails, to view images in my Emacs buffers and to show me the address of my contacts and not just their names.

( setq mu4e-compose-signature-auto-include t mu4e-view-show-images t mu4e-view-prefer-html t mu4e-view-show-addresses t)

This source block is an example of the search queries in mu4e, and part of the reason why I very much like mu4e: these bookmarks are actually defined by search queries, but act as if they were just yet another type of custom inbox you get with modern Email client (and often you don’t even get them). All these bookmarks can be accessed through a shortcut on the main mu4e buffer, prefixed by b . So, for instance, my unread messages are accessed through bU .

( setq mu4e-bookmarks `(( "maildir:/Inbox AND NOT flag:trashed" "Inbox" ?i) (,(s-join " " '( "maildir:/Inbox" "AND NOT flag:trashed" "AND (f:/.*up8 \ .edu|.*univ-paris8.*/" "OR c:/.*up8 \ .edu|.*univ-paris8.*/" "OR t:/.*up8 \ .edu|.*univ-paris8.*/)" )) "University" ?u) (,(s-join " " '( "maildir:/Inbox" "AND (list:ateliers-emacs.framalistes.org" "OR list:ateliers-paris.emacs-doctor.com)" )) "Emacs" ?e) ( "maildir:/Sent" "Sent messages" ?s) ( "flag:unread AND NOT flag:trashed" "Unread messages" ?U) ( "date:today..now" "Today's messages" ?t) ( "date:7d..now" "Last 7 days" ?w) ( "date:1m..now" "Last month" ?m) ( "date:1y..now" "Last year" ?y) ( "flag:trashed" "Trash" ?T) ( "mime:image/*" "Messages with images" ?p)))

On new email arrival, Emacs can send the system a notification which will be handled as any other notification received by the system and will display the number of unread emails to the user; in my case, notifications are handled by AwesomeWM.

( setq mu4e-enable-notifications t mu4e-alert-email-notification-types '(count)) ( with-eval-after-load 'mu4e-alert (mu4e-alert-set-default-style 'notifications)) (add-hook 'mu4e-view-mode-hook 'visual-line-mode)

Now this hook is added so I can get a maximal width for the text of my emails, I really don’t like it when lines are kilometers long. I would like instead to hook visual-line-mode and auto-fill-mode , but for some reasons Emacs throws an error when I add them, So I go with visual-fill-column-mode instead.

(add-hook 'mu4e-view-mode-hook 'visual-fill-column-mode)

On modern-day computers, with wide screens almost everywhere, there is no reason for the email buffer to open below the email directory and not on its right, which is why I set the split view to be vertical instead of horizontal. And to make it more readable, the header window will only occupy 40% of Emacs’ frame, the rest will be given to emails. As you can see, the width of the mu4e headers is evaluated each time we enter it, so it can react to the frame being potentially not the same width than earlier or the window not taking the entire frame. It has to have a minimal size though, I’d say 80 characters is enough for that.

( setq mu4e-split-view 'vertical) (add-hook 'mu4e-headers-mode-hook ( lambda () ( setq mu4e-headers-visible-columns (max 80 (round (* (window-width) 0.4))))))

This is the setup I have for my SMTP mail server: I point Emacs’ SMTP services to my private mail server on its SMTP port, which should be used with a STARTTLS stream. And I tell Emacs this is the default way to send an email.

( setq smtpmail-smtp-server "mail.phundrak.com" smtpmail-smtp-service 587 smtpmail-stream-type 'starttls message-send-mail-function 'smtpmail-send-it)

I am unsure yet if this has any effect on mu4e, but this variable should discourage mu4e from reading rich text emails and instead open them as plain text. However, I do not wish to discourage opening HTML emails since I can compile them to PDF or open them in the browser.

( setq mm-discouraged-alternatives '( "text/richtext" ))

I am still unsure about this variable and if it has an effect on mu4e, but I wish to set a default web viewer for my HTML emails: w3m. This is not as effective as sending the email in the browser or rendering it as a PDF file, but it can be effective enough for some emails.