rmail is the primary emacs mail-reader. i don't know how many people currently use it, but i will ignore any suggestion to treat it as unimportant. – richard stallman
rmail is a major mode in emacs for displaying mbox files, pretty much. it also does some cool things that mean you can use it as an mua. it's surprisingly capable.
who uses rmail? rms, for one. me, for another. here are some other people who have written about it:
rmail doesn't seem to get a lot of love, because emacs comes with the unreasonably powerful gnus built in, and really nice interfaces to notmuch and mu if one is happy to use external packages. it's great that there's choice, but sometimes choice can be scary. rmail works well. let's get into some configuration.
first of all, what are we actually setting up here? i prefer to use emacs as an interface that interacts with other tools, so this setup will not make emacs actually perform network connections or anything like that. instead, we'll use two tools: mpop and msmtp.
mpop is a program that grabs mail over pop and stores it locally in a few different formats. for ease of use with rmail, we'll choose the mbox format. here's a sample configuration:
defaults tls on tls_starttls off auth on account primary keep off host pop.provider.tld port 995 user firstname.lastname@example.org password NotMyPassword delivery mbox ~/documents/mail/inbox
i think this is quite self explanatory. different providers are at different stages of tls and starttls, so change those options as necessary. i have them up the top because i use a few different accounts with the same provider so they're the same and get dry, baby.
if you feel uncomfortable storing your password in plain text (which i guess you probably should?) there is another option which will execute a command and use that as the password, so you can unencrypt a file or something. search the docs for passwordeval. i don't use it because my computer is personal, i don't publish my configuration, and i'm silly. at least mpop won't run if the permissions are too generous.
oh yeah, don't forget to change the delivery option to where you want the mail to end up.
one final thing, i have "keep off" there. that means that mail will be deleted from the server, like pop was designed for. if you're testing, you probably don't want this, set keep to on instead. mpop is clever and won't download messages multiple times (i think). but if you like the system, you should probably get around to keeping off.
okay! on to sending mail. for this we use msmtp, made by the same person as mpop, but a lot more popular, so you can find quite a lot more documentation for it. here's an example configuration:
defaults tls on tls_starttls off auth on account primary host smtp.provider.tld port 587 user email@example.com from firstname.lastname@example.org password NotMyPassword account default: primary
it's pretty similar. there are some differences to note. there are now "user" and "from" options. user is the username you use to log in to the server. this has always been the same email address for me, but i guess sometimes it's different. from is what is actually sent with the mail.
there's also a bit at the bottom "account default: primary" which is useful when using msmtp as sendmail (which is one of its big draws). if you don't specify a from address, it'll assume you meant the specified account (in this case, primary).
now you can test that this works!
echo "hey cutie" | msmtp email@example.com
if you receive an email, you're set! if not, uhh, that sucks :( feel free to email me for help, or read another guide which properly focuses on msmtp. the arch wiki is good: