This page describes how to effectively retrieve mail (from remote machines, spool files, …) and also how you can read them.
The default behaviour using the POP protocol is to move the mail to your local system, that is: it deletes the mail on your server. If you also want to read mail using your phone, you should either switch from POP to IMAP and use a mail client that can handle it, or you must tell the tools you are using that you want to “preserve” your inbox.
Rmail using movemail (but see the note on movemail below):
(setenv "MAILHOST" "pop3server") (setq rmail-primary-inbox-list '("po:username") rmail-pop-password-required t) ;; if you don't want movemail to delete your mail on the server! (setq rmail-preserve-inbox t)
Gnus using the nnml backend with POP:
(setq gnus-secondary-select-methods '((nnml "")) mail-sources '((pop :server "pop3server" :user "username")))
Gnus using IMAP:
(setq gnus-secondary-select-methods '((nnimap "gmail" ;; It could also be imap.googlemail.com if that's your server. (nnimap-address "imap.gmail.com") (nnimap-server-port 993) (nnimap-stream ssl))) ;; Gmail system labels have the prefix [Gmail], which matches ;; the default value of gnus-ignored-newsgroups. That's why we ;; redefine it. gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")
ViewMail using POP:
(setq vm-spool-files '("pop3server:110:pass:username:*" "~/INBOX"))
The whole Emacs process is blocked during mail retrieval if Emacs does it itself. So if you are downloading large mails and tend to use Emacs for almost everything, you lose the multitasking features of your environment. It might be a better idea to use another process like fetchmail to retrieve the mails and offer them in a mailbox to Emacs or to switch to another advanced Mail User Agent like mutt or aerc which is able to use Emacs as its editor, see MuttInEmacs.
These days many people don’t want to touch their local mail system, if they have one. A simple alternative would be
mpop: a program like movemail, except that you configure and run it outside of Emacs. For example:
defaults tls on tls_starttls off keep off password account default host pop.migadu.com port 995 user email@example.com delivery mbox "/home/alex/mail/inbox" # if you like to use pass passwordeval "pass show firstname.lastname@example.org" # if you like to use gpg # passwordeval gpg --no-tty --quiet --decrypt ~/.config/mpop/password.gpg
mpop then fetches your mail and moves it into the inbox you provided, and you get it from there.
There’s a perfect complement to
mpop for sending mail, by the same author:
Rmail and maybe other packages use the “movemail” program for getting e-mail (for example from remote POP3 mailboxes). You specify the mailbox as an URL:
However if your username contains the ‘@’ character, you can’t access your mailbox because movemail’s URL parser interprets everything after the @ as the host name of the POP3 server. For example, Gmail uses the email@example.com notation for usernames… Use fetchmail instead.
Is the situation any better with Gnus or VM? Any really good and sane e-mail client for Emacs?
Using %40 for the at-sign like
pop://username%40hostname:password@hostname:port doesn’t work either. It seems movemail doesn’t support SSL encryption (it does support TLS, but doesn’t work) and somebody on the movemail list suggested using the separate
‘stunnel’ program for SSL tunneling the connection to the server. However I can’t modify Rmail’s invocation of movemail.
Reading mail is just like WritingMail. There is no generic way to call the right tool for you. Some third party package may be mua-aware and thus should be informed of your preference. You have to set
‘read-mail-command’ to do so.
Here are some examples:
See also: WritingMail