2.10 Sending mail

mu4e uses Emacs’s (message)message-mode for writing mail.

For sending mail using SMTP, mu4e uses (smtpmail)smtpmail. This package supports many different ways to send mail; please refer to its documentation for the details.

Here, we only provide some simple examples — for more, see Example configurations.

A very minimal setup:

;; tell message-mode how to send mail
(setq message-send-mail-function 'smtpmail-send-it)
;; if our mail server lives at smtp.example.org; if you have a local
;; mail-server, simply use 'localhost' here.
(setq smtpmail-smtp-server "smtp.example.org")

Since mu4e (re)uses the same message mode and smtpmail that Gnus uses, many settings for those also apply to mu4e.

2.10.1 Dealing with sent messages

By default, mu4e puts a copy of messages you sent in the folder determined by mu4e-sent-folder. In some cases, this may not be what you want - for example, when using Gmail-over-IMAP, this interferes with Gmail’s handling of the sent messages folder, and you may end up with duplicate messages.

You can use the variable mu4e-sent-messages-behavior to customize what happens with sent messages. The default is the symbol sent which, as mentioned, causes the message to be copied to your sent-messages folder. Other possible values are the symbols trash (the sent message is moved to the trash-folder (mu4e-trash-folder), and delete to simply discard the sent message altogether (so Gmail can deal with it).

For Gmail-over-IMAP, you could add the following to your settings:

;; don't save messages to Sent Messages, Gmail/IMAP takes care of this
(setq mu4e-sent-messages-behavior 'delete)

And that’s it! We should now be ready to go.

For more complex needs, mu4e-sent-messages-behavior can also be a parameter-less function that returns one of the mentioned symbols; see the built-in documentation for the variable.