People often say "SMTP server" as if there were one kind. In practice a mail system has two distinct doors that speak the same protocol but do different jobs. One door accepts mail from users and applications that want to send something, and it expects them to identify themselves. The other door accepts mail from other mail servers on behalf of the domains it hosts, and it must accept mail from strangers. Mixing them up leads to the most common configuration problems: applications that cannot connect because they use the wrong port, servers that accept anything (open relays), or recipients that reject mail because it arrived on the wrong path. This guide explains the roles, the ports, what each role should check and repair, and how to configure them. It builds on what an MTA is, which port to use and open relay checks.
The roles
| Role | Name | Typical ports | Who connects | Authentication |
|---|---|---|---|---|
| Mail User Agent (MUA) | The client: a mail program, a script or an application | n/a | Starts the connection | Provides credentials |
| Mail Submission Agent (MSA) | Accepts new mail from authenticated clients (RFC 6409) | 587 (STARTTLS) and 465 (implicit TLS) | Users, devices and applications | Required |
| Mail Transfer Agent (MTA) | Relays mail between servers and delivers to local domains | 25 | Other mail servers | Not used for ordinary delivery |
| Mail Delivery Agent (MDA) | Puts the message into the mailbox | n/a (local) | The MTA | n/a |
| Mail Access (IMAP/POP3) | Lets users read stored mail | 143/993, 110/995 | Users | Required |
One software package such as Postfix or Exim often runs both the MSA and MTA roles, using different listeners and policies. A managed relay is, from your application's point of view, an MSA that then performs the MTA work of delivering to the world.
What the submission service does
- Requires authentication and encryption. Only known users or applications may inject mail, over TLS. See AUTH mechanisms.
- Enforces sender policy. The authenticated user may send only from permitted addresses or domains; this stops one tenant from forging another. See tenant sending.
- Repairs incomplete messages. A submission server may add a missing Date or Message-ID, rewrite local names to full addresses, add a Sender header or correct the envelope. See the Date header and Message-ID.
- Applies limits. Per-user and per-minute rate limits, recipient counts and size limits. See rate shaping.
- Signs the message. DKIM signing normally happens here, after repairs and before delivery. See signed headers.
- Scans and logs. Outbound spam detection protects the shared reputation of the sending IP.
- Queues and delivers through its MTA component, with retries. See retry schedules.
What the transfer service does
- Accepts mail for local domains only. It must refuse to relay mail between two outside domains for an unauthenticated client; otherwise it is an open relay.
- Validates recipients at SMTP time to avoid backscatter. See the null sender.
- Checks the sender: reverse DNS, HELO, blocklists, SPF, DKIM and DMARC, and spam content. See FCrDNS and authentication results.
- Does not repair messages in the same way. A message arriving on port 25 is expected to be complete already.
- Tolerates unknown clients but defends with greeting delays, limits and greylisting. See the SMTP banner.
Why port 25 is blocked for end users
Because port 25 requires no authentication to deliver to the world, malware on a desktop or a compromised server can send spam directly from the victim's IP address. Internet providers and cloud platforms therefore block outbound connections to port 25 from customer networks, sometimes lifting the block on request after vetting. The block is not a fault; it pushes legitimate senders to submission through an authenticated relay, where abuse can be limited per account. If an application cannot reach a relay on port 25, the solution is to use 587 or 465 with credentials, not to ask for the block to be removed. See connection timeouts.
The three ports compared
| Port | Name | Encryption | Use | Common problem |
|---|---|---|---|---|
| 25 | SMTP (MTA to MTA) | Opportunistic STARTTLS | Server-to-server delivery | Blocked outbound by providers; do not use for app submission |
| 587 | Submission | STARTTLS (required by policy) | Clients and applications to a server | Client skips STARTTLS or the AUTH step |
| 465 | SMTPS / submission over implicit TLS | TLS from the first byte (re-standardised in RFC 8314) | Clients and applications; preferred by some providers | Client tries STARTTLS on a port that expects TLS immediately |
| 2525 | Unofficial alternative | Same as 587 | When 587 is blocked by a network | Not universally available |
Setting up submission in Postfix
# /etc/postfix/master.cf (submission service on 587)
submission inet n - y - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_tls_auth_only=yes
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o smtpd_sender_login_maps=hash:/etc/postfix/sender_logins
-o smtpd_sender_restrictions=reject_sender_login_mismatch
-o cleanup_service_name=authclean
# Implicit TLS on 465
smtps inet n - y - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_relay_restrictions=permit_sasl_authenticated,rejectThe key points are the encryption requirement, authentication, a relay policy that permits only authenticated users and a mapping that ties each login to the sender addresses it may use. The public port 25 service keeps a different policy: reject_unauth_destination so only local domains are accepted from strangers.
Why not use one port for everything
It is tempting to run a single listener that accepts both strangers and logged-in users, and some small servers do. The cost is complexity in every rule: the same service must accept unauthenticated mail for local recipients, refuse it for everyone else, require encryption only for some clients and apply different limits and repairs depending on who connected. Separate listeners make each policy simple and testable, let you firewall or monitor them independently and allow you to move the submission service to different hardware or a different provider without touching your public MX. They also make incident response easier: if a credential leaks, you can cut off the submission service while mail from the outside world continues to arrive.
Common problems
| Problem | Cause | Fix |
|---|---|---|
| Application cannot send, "connection timed out" on 25 | Provider blocks port 25 | Use 587 or 465 with authentication |
| "Relay access denied" on submission | Client not authenticated, or sender not permitted | Check AUTH, TLS and the sender login map |
| "Must issue a STARTTLS command first" | Client attempts AUTH before upgrading | Enable STARTTLS or use port 465 |
| Mail accepted but marked as spoofed by recipients | Submitted From address not authorised for the domain | Align SPF, DKIM and DMARC. See envelope From |
| Users can send as anyone | No sender-login enforcement | Add sender restrictions on the submission service |
| Internal devices cannot use TLS | Old firmware | Use an internal relay that accepts the device and forwards over TLS, restricted by IP |
Choosing the right path for your application
- If the application sends through a provider, use the provider's submission host on 587 or 465 with a dedicated credential, or its HTTP API. See the email API.
- If the application sends through your own server, create a submission service and an account per application.
- If devices only support port 25 without TLS, place a small internal relay on a trusted network segment, restrict it by source address and have it forward to the submission service of your real relay.
- Test with a transcript to confirm the sequence: banner, EHLO, STARTTLS, AUTH, MAIL FROM. See reading a transcript.
- Monitor the submission service separately from the public MX, with its own alerts. See SMTP monitoring.
Submission and transfer share a protocol but not a purpose. Keep port 587 or 465 for authenticated senders, with encryption, policy and logging, keep port 25 for server-to-server mail with strict acceptance rules and your sending stays both reliable and safe.
Use a managed submission service Authenticated sending on standard ports.
References and further reading
Frequently asked questions
What is the difference between port 25 and port 587?
Port 25 is for server-to-server mail transfer; port 587 is for authenticated submission of new mail by users and applications.
Why is port 25 blocked by many providers?
It needs no login to deliver mail anywhere, so infected machines use it to send spam; blocking it pushes senders toward authenticated submission.
Should I use 465 or 587?
Either works. 465 uses TLS from the first byte; 587 starts plain and upgrades with STARTTLS. Use what your provider documents.
What does a submission server do that an MTA does not?
It authenticates senders, enforces sender policy, can repair headers, applies limits and signs messages.
How do I send from a device that only supports port 25?
Use a restricted internal relay that accepts the device and forwards over an authenticated, encrypted submission connection.