C.4 Writing messages

C.4.1 How can I automatically set the From:-address for a reply-message?

See Compose hooks.

C.4.2 How can I dynamically determine the folders for draft/sent/trashed messages?

See Dynamic folders.

C.4.3 How can I define aliases for (groups of) e-mail addresses?

See (emacs)Mail Aliases.

C.4.4 How can I automatically add some header to an outgoing message?

See Compose hooks.

C.4.5 How can I influence the way the original message looks when replying/forwarding?

Since mu4e-compose-mode derives from See (message)Top, you can re-use many (though not all of its facilities.

C.4.6 Replying to unquoted contacts with commas in their name

Senders may have commas in their RFC2047-encoded name without using the needed quoting, for instance From: Foo, the great Bar <foo@bar.com> instead of From: "Foo, the great Bar" <foo@bar.com>.

By default, when replying to such messages, mu4e then interprets the address as multiple contacts. To avoid that, you can add to your configuration:

(setq rfc2047-quote-decoded-words-containing-tspecials t)

C.4.7 How can I easily include attachments in the messages I write?

You can drag-and-drop from your desktop; alternatively, you can use (emacs)Dired.

C.4.8 How can I start a new message-thread from a reply?

Remove the In-Reply-To header, and mu4e automatically removes the (hidden) References header as well when sending it. This makes the message show up as a top-level message rather than as a response.

C.4.9 How can I attach an existing message?

Use mu4e-action-capture-message (i.e., a c in the headers view) to ‘capture’ the to-be-attached message, then when editing the message, use M-x mu4e-compose-attach-captured-message.

C.4.10 How can I sign or encrypt messages?

You can do so using Emacs’ MIME-support — check the Attachments-menu while composing a message. Also see Signing and encrypting.

C.4.11 Address auto-completion misses some addresses

If you have set mu4e-compose-complete-only-personal to non-nil, mu4e only completes ’personal’ addresses - so you tell it about your e-mail addresses when setting up the database (mu init); Initializing the message store.

If you cannot find specific addresses you’d expect to find, inspect the values of mu4e-compose-complete-only-personal, mu4e-compose-complete-only-after and mu4e-compose-complete-max.

C.4.12 How can I get rid of the message buffer after sending?

(setq message-kill-buffer-on-exit t)

C.4.13 Sending big messages is slow and blocks Emacs

And what can I do about it?

For this, there’s emacs-async (also available from the Emacs package repository); add the following snippet to your configuration:

(require 'smtpmail-async)
(setq
  send-mail-function 'async-smtpmail-send-it
  message-send-mail-function 'async-smtpmail-send-it)

With this, messages are sent using a background Emacs instance.

A word of warning though, this tends to not be as reliable as sending the message in the normal, synchronous fashion, and people have reported silent failures, where mail sending fails for some reason without any indication of that.

You can check the progress of the background delivery by checking the *Messages*-buffer, which should show something like:

Delivering message to "William Shakespeare" <will@example.com>...
Mark set
Saving file /home/djcb/Maildir/sent/cur/20130706-044350-darklady:2,S...
Wrote /home/djcb/Maildir/sent/cur/20130706-044350-darklady:2,S
Sending...done

The first and final messages are the most important, and there may be considerable time between them, depending on the size of the message.

C.4.14 Using a separate frame or window for composing.

Is it possible to view headers and messages, or compose new ones, in a separate frame or window?

Yes. There is built-in support for composing messages in a new frame or window. Either use Emacs’ standard compose-mail-other-frame (C-x 5 m) and compose-mail-other-window (C-x 4 m) if you have set up mu4e as your Emacs e-mailer.

Additionally, there’s the variable mu4e-compose-switch (see its docstring) which you can customize to influence how mu4e creates new messages.

C.4.15 How can I apply format=flowed to my outgoing messages?

Plain text emails with Content-Type: text/plain; format=flowed can be re-flowed (i.e. line endings removed, paragraphs refilled) by receiving clients that support this standard. Clients that don’t support this, show them as is, which means this feature is truly non-invasive.

Here’s an explanatory blog post which also shows why this is a desirable feature: https://mathiasbynens.be/notes/gmail-plain-text (if you don’t have it, your mails mostly look quite bad especially on mobile devices) and here’s the RFC with all the details.

Since version 0.9.17, mu4e sends emails with format=flowed by setting

(setq mu4e-compose-format-flowed t)

in your Emacs init file (~/.emacs or ~/.emacs.d/init.el). The transformation of your message into the proper format is done at the time of sending. For this to happen properly, you should write each paragraph of your message of as a long line (i.e. without carriage return). If you introduce unwanted newlines in your paragraph, use M-q to reformat it as a single line.

If you want to send the message with paragraphs on single lines but without format=flowed (because, say, the receiver does not understand the latter as it is the case for Google or Github), use M-x use-hard-newlines (to turn use-hard-newlines off) or uncheck the box format=flowed in the Text menu when composing a message.

C.4.16 How can I avoid Outlook display issues?

Limited testing shows that certain Outlook clients do not work well with inline replies, and the entire message including-and-below the first quoted section is collapsed. This means recipients may not even notice important inline text, especially if there is some top-posted content. This has been observed on OS X, Windows, and Web-based Outlook clients accessing Office 365.

It appears the bug is triggered by the standard reply regex "On ... wrote:". Changing "On", or removing the trailing ":" appears to fix the bug (in limited testing). Therefore, a simple work-around is to set ‘message-citation-line-format‘ to something slightly non-standard, such as:

(setq  message-citation-line-format "On %Y-%m-%d at %R %Z, %f wrote...")