There are five major parts involved in an email exchange: the Mail User Agent (MUA), the Mail Transfer Agent (MTA), a mail host, a remote or local mailbox, and DNS. This section provides an overview of these components.
The Mail User Agent (MUA) is an
	    application which is used to compose, send, and receive
	    emails.  This application can be a command line program,
	    such as the built-in mail utility or a
	    third-party application from the Ports Collection, such as
	    mutt,
	    alpine, or
	    elm.  Dozens of graphical
	    programs are also available in the Ports Collection,
	    including Claws Mail,
	    Evolution, and
	    Thunderbird.  Some
	    organizations provide a web mail program which can be
	    accessed through a web browser.  More information about
	    installing and using a MUA on FreeBSD can
	    be found in Section 28.10, “Mail User Agents”.
The Mail Transfer Agent (MTA) is responsible for receiving incoming mail and delivering outgoing mail. FreeBSD ships with Sendmail as the default MTA, but it also supports numerous other mail server daemons, including Exim, Postfix, and qmail. Sendmail configuration is described in Section 28.3, “Sendmail Configuration Files”. If another MTA is installed using the Ports Collection, refer to its post-installation message for FreeBSD-specific configuration details and the application's website for more general configuration instructions.
The mail host is a server that is responsible for
	    delivering and receiving mail for a host or a network.
	    The mail host collects all mail sent to the domain and
	    stores it either in the default mbox
	    or the alternative Maildir format, depending on the
	    configuration.  Once mail has been stored, it may either
	    be read locally using a MUA or remotely
	    accessed and collected using protocols such as
	    POP or IMAP.  If
	    mail is read locally, a POP or
	    IMAP server does not need to be
	    installed.
To access mailboxes remotely, a POP or IMAP server is required as these protocols allow users to connect to their mailboxes from remote locations. IMAP offers several advantages over POP. These include the ability to store a copy of messages on a remote server after they are downloaded and concurrent updates. IMAP can be useful over low-speed links as it allows users to fetch the structure of messages without downloading them. It can also perform tasks such as searching on the server in order to minimize data transfer between clients and servers.
Several POP and IMAP servers are available in the Ports Collection. These include mail/qpopper, mail/imap-uw, mail/courier-imap, and mail/dovecot2.
It should be noted that both POP and IMAP transmit information, including username and password credentials, in clear-text. To secure the transmission of information across these protocols, consider tunneling sessions over ssh(1) (Section 13.8.1.2, “SSH Tunneling”) or using SSL (Section 13.6, “OpenSSL”).
The Domain Name System (DNS) and
	    its daemon named play a large role in
	    the delivery of email.  In order to deliver mail from one
	    site to another, the MTA will look up
	    the remote site in DNS to determine
	    which host will receive mail for the destination.  This
	    process also occurs when mail is sent from a remote host
	    to the MTA.
In addition to mapping hostnames to IP addresses, DNS is responsible for storing information specific to mail delivery, known as Mail eXchanger MX records. The MX record specifies which hosts will receive mail for a particular domain.
To view the MX records for a domain, specify the type of record. Refer to host(1), for more details about this command:
%host -t mx FreeBSD.orgFreeBSD.org mail is handled by 10 mx1.FreeBSD.org
Refer to Section 29.7, “Domain Name System (DNS)” for more information about DNS and its configuration.
All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/
Questions that are not answered by the
    documentation may be
    sent to <freebsd-questions@FreeBSD.org>.
    Send questions about this document to <freebsd-doc@FreeBSD.org>.