An email system is split into specialised programs. The mail user agent (MUA) is the application a person uses to read and write mail. The mail submission agent (MSA) accepts a new message from the MUA after authenticating the sender. The mail transfer agent (MTA) moves messages between servers over SMTP. The mail delivery agent (MDA) takes the final message and places it into the recipient's mailbox. Retrieval by the user then happens through IMAP or POP3, usually provided by an access server alongside the MDA.
In small installations one product can play several roles, which is why the terms confuse people. Knowing which role is failing is the fastest way to troubleshoot: a login problem points at the MSA, a routing or reputation problem at the MTA, a mailbox or quota problem at the MDA, and a display problem at the MUA.
The journey of a message
- Compose. The sender writes a message in an MUA.
- Submit. The MUA connects to the sender's mail server, usually on port 587 with STARTTLS, or 465 with implicit TLS, and authenticates. The server role that accepts it is the MSA.
- Route. The sending MTA looks up the MX records for the recipient domain and connects to the best-priority server, typically on port 25.
- Accept. The receiving MTA checks the connection, authentication results and policies, then accepts or rejects the message.
- Deliver. The receiving MTA hands the message to the MDA, which writes it to the user's mailbox after any filtering.
- Read. The recipient's MUA fetches the message over IMAP or POP3, or the webmail interface reads it directly.
For a high-level view see how email works. Each hop adds a Received header, so the path can be reconstructed afterwards. See Received headers.
MUA: mail user agent
The MUA is the part people see. It composes messages, displays them, manages folders and contacts and speaks two kinds of protocol: SMTP to send, IMAP or POP3 to read. Examples are desktop clients, mobile mail apps and browser-based webmail. A script that sends mail through a library is also an MUA from the server's point of view, because it submits a message. The MUA does not deliver mail to other domains by itself. It hands the message to a server.
MSA: mail submission agent
RFC 6409 defines message submission as a separate service from relay between servers. The MSA listens on port 587 (and servers commonly offer 465 with implicit TLS), requires authentication and may correct or complete a message, for example by adding a missing Date or Message-ID header. Splitting submission from relay lets operators require login for users while accepting unauthenticated mail from other servers on port 25. In many products the MSA and MTA are the same program listening on different ports. See SMTP submission.
MTA: mail transfer agent
The MTA is the postal sorting and transport layer. It accepts messages, decides where to send them, queues them, retries on temporary failure and generates bounces when delivery fails permanently. Well-known MTAs include Postfix, Exim, Sendmail and KumoMTA. An MTA is both a server, when it receives mail, and a client, when it forwards it. The queue, retry schedule and bounce handling are what make email reliable even when remote servers are unavailable. See what an MTA is and a comparison of common MTAs.
MDA: mail delivery agent
The MDA is the last step on the receiving side. It takes a message from the MTA and writes it to storage: a Maildir directory, an mbox file or a database. On the way it can apply user rules, run spam and virus filtering, enforce quotas and move the message to the right folder. Examples include Dovecot's local delivery agent and LMTP service, procmail and maildrop. Between the MTA and MDA, many systems use LMTP (RFC 2033), a variation of SMTP made for final delivery, which allows a status per recipient. When a mailbox is full, the failure arises here and shows up as a bounce.
Access servers: IMAP and POP3
A fifth role is the server that lets clients read stored mail. IMAP keeps messages on the server and synchronises state across devices. POP3 typically downloads and may remove messages from the server. Dovecot is a common implementation that provides both IMAP and the delivery side. See IMAP, POP3 and SMTP compared.
Summary table
| Role | Full name | Main protocol | Typical ports | Examples | Problems here look like |
|---|---|---|---|---|---|
| MUA | Mail user agent | SMTP out, IMAP or POP3 in | Client side | Thunderbird, Outlook, Apple Mail, webmail, app code | Wrong settings, display issues, cannot connect |
| MSA | Mail submission agent | SMTP submission | 587, 465 | Postfix submission service, provider relay | 535 authentication failed, 530 STARTTLS required |
| MTA | Mail transfer agent | SMTP | 25 between servers | Postfix, Exim, Sendmail, KumoMTA | Deferrals, blocklists, 550 rejections, routing failures |
| MDA | Mail delivery agent | LMTP or local delivery | Local socket | Dovecot, procmail, maildrop | Mailbox full, filtering mistakes, permission errors |
| Access server | IMAP or POP3 server | IMAP, POP3 | 993, 143, 995, 110 | Dovecot, Cyrus | Cannot read or sync mail |
A simple server layout
A typical self-hosted setup has Postfix as MSA and MTA, Dovecot as MDA and IMAP server, and rules that pass mail from one to the other. The Postfix line below hands final delivery to Dovecot over LMTP. Paths depend on your distribution and configuration, so treat it as an illustration.
# /etc/postfix/main.cf (illustrative)
virtual_transport = lmtp:unix:private/dovecot-lmtp
smtpd_tls_security_level = may
# /etc/postfix/master.cf (submission service for authenticated users)
submission inet n - y - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_recipient_restrictions=permit_sasl_authenticated,rejectSeeing the roles in practice
You can observe the MTA and MSA directly with a few commands. The first finds where mail for a domain should go. The second opens a STARTTLS session to a submission service and shows its greeting and capabilities.
dig +short MX example.com
openssl s_client -starttls smtp -connect smtp.migosmtp.com:587 -crlf
# After the banner, type: EHLO test.example.comThe EHLO response lists the extensions offered, such as AUTH mechanisms after TLS has started. A longer walkthrough is in testing an SMTP server.
Where hosted services fit
Most people do not run all these components. A mailbox provider gives you an MUA (webmail), an MSA, an MTA, an MDA and an access server as one service. An SMTP relay or email API provider runs the MSA and MTA parts for you: your application acts as the MUA, authenticates to the submission service and the provider's MTA routes the mail, retries it and reports bounces. You still receive replies at a mailbox provider's MDA. Understanding the split helps you choose the right service, since sending infrastructure and mailbox hosting are different jobs.
Troubleshooting by role
| Symptom | Role to check | First step |
|---|---|---|
| Cannot log in to send | MSA | Check username, password, port and TLS mode |
| Sent but never arrives, no bounce | Sending MTA | Look at the queue and the logs for deferrals |
| Immediate 550 or 554 rejection | Receiving MTA | Read the response text for the reason, then the policy it cites |
| Bounce says mailbox full | MDA | Ask the recipient to free space or raise the quota |
| Message arrives but is in the wrong folder | MDA filters | Review server rules and filters |
| Message delivered but not visible in the client | MUA or access server | Check IMAP sync, folder subscriptions and client filters |
Four small programs and two retrieval protocols make up the email system most people use daily. Knowing which one is responsible makes logs and error messages far easier to read, and tells you whether a problem belongs to you, your provider or the recipient.
Hand off the sending roles Use the SMTP relay as your submission and transfer service and keep your application as the MUA.
References and further reading
Frequently asked questions
What is the difference between an MTA and an MDA?
An MTA routes and transfers messages between servers over SMTP. An MDA takes the final message and stores it in the recipient mailbox.
What is an MUA?
The mail user agent is the client application that composes, sends and displays mail, such as Thunderbird, Outlook or webmail.
What is an MSA?
The mail submission agent accepts mail from authenticated users, usually on port 587 or 465, and passes it on to the MTA.
Is Postfix an MTA or an MDA?
Postfix is an MTA. It hands final delivery to an MDA such as Dovecot over LMTP or to local delivery.
Where do IMAP and POP3 fit?
They are retrieval protocols used by the MUA to read mail from the stored mailbox, not to send or route it.