There are three things you need for basic email:
- a program to format RFC 822 email that you are about to send
- a program to send (RFC 822) formatted emails to your mail relay/submission system over SMTP (mail submission agent — MSA, or mail transfer agent — MTA)
- a program to access your remote mailbox for things like remotely saved drafts, your inbox, etc. by using IMAP, POP, SMAP, rsyncing to a local mbox or maildir, or even just using
sshfs
to make the said mbox or maildir available on the filesystem (mail user agent — MUA, usually bundles the first component)
If you see the term 'mail delivery agent' (MDA), ignore it. That's a server-side program program for those creating their own service.
You likely already have the MUA (mutt
, mailx
, alpine
, etc.), as well as the third component. The MSA likely is also built into the same program that is your MUA. Take a look at the following.
For example, for, the offical Arch Linux mutt
package, in the simplest configuration (see muttrc(5)
):
# MUA part set folder = "imaps://foo@example.com" # shortcut so that I can use relative # names for $spoolfile, etc. set spoolfile = "=INBOX" set record = "=Sent Messages" set postponed = "=Drafts" set from = "foo@example.com" # MSA/MTA part set smtp_url = "smtp://foo@example.com" # or `foo@example.com@example.com` # if the server requires a fully # qualified user name, say because it # serves multiple domains
I've never used alpine but the Arch Wiki has a page on it.
For mailx (heirloom-mailx
package, I believe the following ~/.mailrc
(see mailx(1)
) will do. Use mailx -A example.com
to tell mailx to use that account.
account example.com { set folder=imaps://foo@example.com set imap-auth=login set record=+Sent set set smtp=example.com set smtp-auth=plain # or whatever your server uses set smtp-auth-user=foo set from="foo@example.com (Foo Bar)" set hostname=example.com }
Now, read on if you still want to use the traditional standalone MTA method. Since most traditional MUAs like mutt or mailx can use the sendmail
interface (i.e., they just pipe mail to the sendmail
binary, and you're only sending mail, not setting up a full-blown mail server, use the Dragonfly Mail Agent, rather than downloading a full server (like Postfix or sendmail). It's in the AUR. It just works and is only running when you actually send mail (i.e., it's not a deamon). It provides a wrapper binary at /usr/bin/sendmail
. There's no configuration, assuming you're using an open relay. If you are using a relay that requires SMTP AUTH (you may often hear the term SASL, which is partially accurate), you can do something like what follows:
File /etc/dma/auth.conf
:
some user|some mail relay or submission system:password
File /etc/dma/dma.conf
(in addition to what is already in there by default):
SMARTHOST=hostname or IP address of smarthost or submission system or mail relay
You may have to configure your MUAs accordingly though. If I recall correctly, mailx
and mutt
need no additional configuration.