The standard setup for mu4e uses smtpmail to actually send the messages. This works fine for the most part, but by default it does not run asynchronously, so emacs pauses when a mail is sent. Usually this is very brief, but for messages with large attachments it can be very noticeable. This was particularly annoying to me when I started developing a package to add a two minute delay to all outgoing mail to give an “undo send” functionality (I’ll post more about this package soon). When the two minute timer finished and the mail was sent, I would be working on something else, and emacs would hang briefly, which was a bit annoying.
It is possible to configure mu4e to send the mail asynchronously, but apparently this can be unreliable. A better solution is to run your own mail server to handle outgoing mail. This is supported in mu4e, and mu4e hands off the mail to the server to send, so it happens instantly from the user’s point of view, regardless of the size of the mail. Another benefit is that mail sent while you are offline is handled automatically; the server queues the mail and then sends it when you reconnect.
I am using OS X Yosemite, and setting up a mail server was quite easy. The postfix mail server is installed by default on OS X, so it was just a matter of configuring it to work with my gmail account. I followed these helpful instructions, noting the advice in the comments that for Yosemite, the extra line
smtp_sasl_mechanism_filter = login
Now we tell mu4e to use postfix to handle sending mail by adding the following to our emacs config file:
;;send mail using postfix (setq send-mail-function 'sendmail-send-it) (setq message-send-mail-function 'message-send-mail-with-sendmail)
(Note the references to “sendmail” are because this was the name of one of the original mail servers on unix/linux. Postfix is a more modern mail server that is compatible with sendmail.)
This should be all you need to switch to using postfix to send your mail. Some useful commands (to run at the command line, not using
M-x in emacs) are
sudo postfix start sudo postfix stop
to start and stop the server, and
to list the current queue of unsent mail. This will generally be empty, but if you have been offline you might see some mails in there. They should send automatically once the server notices you are back online, but if not, use
to send all mail in the queue. See the man pages for more functionality.
So there you are. This might not be for everyone, but if you don’t mind fiddling with some config files, I highly recommend moving over to postfix for sending your mail.
原文出处: Pragmatic Emacs
原文时间: 2016-04-10 05:08
整理时间: 2016-04-22 03:21
本文由 Hick 整理，转载请保留以上信息;
The articles on this site come from Internet, thanks to all the original authors.
If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .