Port 587 Is for Sending, Not Receiving Mail

Most mail integration tickets do not start with „wrong password.“ They start with a client pointed at the wrong socket. A developer copies a hostname and a port from a tutorial, pastes them into a config, and gets a timeout, a TLS handshake error, or a cryptic protocol response. The credentials were fine the whole time. The port was doing a different job than the client assumed. That is the pattern behind a large share of failed IMAP vs POP3 setups, and it is the reason this guide is organized around mistakes rather than features.

The single most common version of that mistake: someone configures port 587 for receiving mail. It looks reasonable. 587 is documented, it is widely enabled, and it supports encryption through STARTTLS. But 587 is the SMTP submission port, and SMTP handles sending mail. Point an incoming mail client at it and you are speaking the retrieval protocol to a server that expects to accept messages for delivery. The connection either dies immediately or hangs until the client times out. Nothing about the password will fix it. The fix is understanding that every connection has a role, and each role has its own port.

Sort the roles once and most of these failures disappear. IMAP keeps mail on the server and uses encrypted port 993. POP3 downloads mail to a single client and uses encrypted port 995. SMTP handles sending mail, on 587 with STARTTLS or 465 with implicit TLS. Retrieval ports and submission ports are not interchangeable, and neither are the encryption modes that ride on them. The IMAP vs POP3 differences matter here too, because the retrieval protocol you pick determines which incoming port is even valid, and a client configured for one protocol will not negotiate with the other’s port no matter how correct the SSL checkbox looks.

The rest of this piece is a checklist of the mismatches that cause silent failures: implicit TLS on 587, plain text on 993 or 995, STARTTLS aimed at 465, submission ports used for retrieval, and automation scripts that copy a sending config into an inbox job. Each one gets its symptom and its correction. If you are wiring up POP3 for SEO automation or validating a catch-all domain before a launch, the port and SSL layer is where the deployment breaks, and it is worth ten minutes of verification before the first connection attempt.

Why Port and SSL Choices Break More Mail Setups Than Passwords Do

Nine out of ten failed mailbox connections I get asked about have nothing to do with the password. The credentials are fine. The hostname resolves. What is broken is the triple of role, port, and encryption mode: the client is pointed at the wrong service, or it is speaking the right protocol on the wrong socket, or it is wrapping a connection in TLS that the server expects to negotiate later. Fix those three and the login usually succeeds on the first retry.

The failure is almost never the password

Mail servers expose separate services for separate jobs. SMTP handles sending mail. IMAP or POP3 handles retrieval. Each service listens on its own port, and each port carries an expected encryption mode. Get one element wrong and the server either refuses the connection outright or accepts it and then answers with a protocol error that reads like a credentials problem to anyone skimming logs.

That is why a password rotation rarely fixes a connection that never worked. If a client sends an IMAP command to a submission port, no password on earth will get it a mailbox listing. The server is not authenticating an incoming session because it is not running one on that socket. The symptom, a hang or a terse „connection closed,“ sends people down the wrong path for hours.

Count the combinations. Two retrieval protocols, three common ports, two encryption modes, plus a submission port that looks like a retrieval port to anyone who does not know the difference. Most of those combinations are wrong, and several of them fail silently rather than loudly.

Role, port, and encryption have to agree before anything else

Treat the pairing as a contract. The incoming mail server role maps to IMAP on port 993 with implicit TLS, or POP3 on port 995 with implicit TLS. The outgoing mail server role maps to SMTP on port 587 with STARTTLS, or port 465 with implicit TLS. Those are the sane defaults, and they cover the overwhelming majority of providers.

A few concrete numbers worth keeping in view:

  • IMAP on 993: TLS from the first byte. The client does not send a plain greeting first.
  • POP3 on 995: same model, TLS wrapped immediately.
  • SMTP on 587: plain connection, then STARTTLS upgrade, then authentication and submission.
  • SMTP on 465: implicit TLS, legacy naming aside, still widely supported for submission.
  • Port 143 and port 110: plaintext IMAP and POP3, usually blocked or should be.

The version details matter less than the socket. IMAP4rev2 is defined by RFC 9051 and POP3 by RFC 1939, but a client that ignores the port will never reach either specification. Encryption mode is the second half of the contract: implicit TLS on 993 or 995 means the client must not attempt a plaintext handshake first, and STARTTLS on 587 means it must not assume TLS is already active.

Check the role first, then the protocol, then the port, then the encryption mode. When a setup fails, the mismatch is almost always sitting in one of those four slots, not in the password field.

Port 587 Is for Sending, Not Receiving Mail

Port 587 shows up in a lot of broken configs. It is a real port, it is encrypted, and it appears in provider documentation, so people paste it into the incoming mail server field and expect mail to arrive. It will not. Port 587 is the SMTP submission port: it carries mail from a client to a server for delivery. Nothing on 587 hands messages back to you. A retrieval client pointed at it completes a TCP handshake, receives an SMTP greeting starting with 220, and then fails, usually with a protocol error or a timeout, because the client is speaking IMAP or POP3 to a server that only speaks SMTP.

The confusion comes from how 587 is described. It is the „secure“ submission port, and that is accurate. It runs SMTP with STARTTLS, which means the session opens in plain text and upgrades to TLS after the EHLO exchange. Security is not the problem. Direction is. SMTP handles sending mail; it does not store it for retrieval. That job belongs to the incoming mail server, and the incoming side has exactly two encrypted ports worth knowing.

Role Protocol Port Encryption
Incoming (retrieval) IMAP 993 Implicit TLS
Incoming (retrieval) POP3 995 Implicit TLS
Outgoing (submission) SMTP 587 STARTTLS
Outgoing (submission, legacy) SMTP 465 Implicit TLS

Read the table by column, not by row. If a setup form has an incoming mail server field, the only valid encrypted answers are 993 or 995, and which one depends on whether the client speaks IMAP or POP3. If the form asks for an outgoing mail server, 587 or 465 are the answers, and they are not interchangeable in one respect: 587 expects STARTTLS while 465 expects TLS from the first byte. The protocol definitions back this up. IMAP4rev2 is defined by RFC 9051, and POP3 by RFC 1939, neither of which has anything to say about submission. Mixing the two roles is a category error, not a settings tweak.

Three symptoms tell you a 587-in-incoming mistake is in play. First, the client connects and then errors immediately with something like „unrecognized command“ or „server does not support IMAP.“ Second, a mail library reports a timeout even though a telnet test to 587 returns a 220 banner, which proves the network path is fine and the protocol is wrong. Third, sending works perfectly while receiving never does, because the outgoing half of the config is the only half that was set correctly.

One more trap: some hosts block outbound 25 but leave 587 open, and people interpret „587 works“ as „587 is my mail port.“ Test with the right tool. openssl s_client -connect mail.example.com:993 -crlf should return an IMAP greeting if the server is what you think it is. If you run that against 587, you get an SMTP banner instead, and the mismatch is right there in the first line of output.

Common Port and SSL Mismatches That Cause Silent Failures

Most of these failures do not announce themselves. The client connects, the TCP handshake completes, and then everything stalls or throws a generic „connection failed“ that points nowhere useful. Here are the mismatches that account for the majority of them, with the symptom each one produces.

  • Implicit TLS on port 587. Setting the client to SSL/TLS on 587 makes it open a TLS handshake immediately, but 587 expects plain text first and then a STARTTLS upgrade. The server waits for an SMTP greeting the client never sends, and the client waits for a server hello that never comes. Symptom: connection timeout or „SSL routines: wrong version number“ after 30 seconds of silence.
  • Plain text on 993 or 995. IMAP uses encrypted port 993 and POP3 uses encrypted port 995, both as implicit TLS. Pointing a client at either port with encryption set to None produces a garbled response the parser cannot read. Symptom: „unexpected response“ or „protocol error“ right after connect, sometimes with binary junk in the logs.
  • STARTTLS on port 465. Port 465 is implicit TLS (SMTPS), not STARTTLS. A client configured for STARTTLS connects in plain text and waits for a capability line that arrives already encrypted. Symptom: handshake failure or an immediate disconnect, often logged as „connection reset by peer.“
  • Submission port used for retrieval. Port 587 is SMTP submission, and SMTP handles sending mail only. An incoming client pointed there gets an SMTP banner („220 mail.example.com ESMTP“) instead of an IMAP or POP3 greeting. Symptom: „server does not support IMAP“ or a login prompt that never appears.
  • Retrieval port used for sending. The reverse happens too: 993 or 995 in the outgoing mail server field. The SMTP client receives an IMAP or POP3 banner and cannot parse it. Symptom: send failures while receiving works fine, which sends people hunting for password problems that do not exist.
  • Certificate name mismatch after a port fix. Once the port is right, a self-signed or wrong-hostname certificate on the incoming mail server triggers a verification error. Symptom: „certificate verify failed“ or a client that works only with verification disabled, which is a bad habit to bake into automation.

The pattern behind every entry: role, protocol, port, and encryption mode are four separate settings, and changing one without the others creates a pair that cannot negotiate. A client set to SSL on 587 and a client set to STARTTLS on 465 fail in opposite ways, but both come from the same assumption that „secure“ is a single toggle rather than a mode tied to a specific port.

Check the logs before changing credentials. A timeout with no banner points at encryption mode. A banner that names the wrong protocol points at the port. Authentication errors come later, after the connection is already established. Sorting failures into those three buckets cuts diagnosis time to a minute or two per mailbox.

IMAP vs POP3 Differences That Decide Which Port You Need

The choice between IMAP and POP3 is not a preference toggle you can flip after the fact. It is an architectural decision, and it fixes your incoming port before you type a single character into a settings form. Pick the protocol first, then the port follows. Do it the other way around and you get the classic failure: a client pointed at the wrong retrieval port, timing out or throwing a protocol error, while the credentials were fine all along.

Start with what each protocol does to the mailbox. IMAP keeps mail on the server. The client is a window into a remote store, and every action (reading, flagging, moving to a folder, deleting) is a state change on that store. POP3 downloads mail to a single client and, by default, removes it from the server. The mailbox is a staging area, not a home.

That difference drives everything downstream:

  • Server-side folders. IMAP synchronizes folders and read states across devices. POP3 supports inbox only. There is no folder concept to sync, so any tool expecting to walk a folder tree will see one flat list.
  • Multi-device behavior. With IMAP, a message read on your laptop shows as read on your phone. With POP3, each client maintains its own copy and its own idea of what has been read.
  • Storage location. IMAP mail counts against server quota. POP3 mail counts against local disk, which is why POP3 setups often look cheap until the server starts bouncing new mail because the quota filled with messages nobody deleted.
  • Retention control. POP3 clients can be set to leave messages on server, but that is a client-side flag, not a protocol guarantee. Two clients fetching the same account can both download the same message and both delete it, and neither knows what the other did.

Now the ports. IMAP uses encrypted port 993, implicit TLS, connection encrypted from the first byte. The older plaintext port 143 with STARTTLS upgrade still exists and still works, but it is a negotiation path with more failure modes, and there is no reason to choose it for a new setup. POP3 uses encrypted port 995, also implicit TLS. Its plaintext ancestor is 110, with the same STARTTLS caveat.

Both protocols are governed by their specs, and the specs are worth knowing when a vendor’s documentation contradicts itself. IMAP4rev2 is defined by RFC 9051, which supersedes the older IMAP4rev1 profile. Post Office Protocol version 3 is defined by RFC 1939. Neither document assigns port numbers; those come from IANA registrations, which is why „IMAP port 993“ and „POP3 port 995“ are conventions you verify rather than derive.

Here is the practical consequence. If you configure a client for POP3 but enter 993, you are speaking POP3 to an IMAP listener. The server may accept the TCP connection and then reject the first command, or hang waiting for a valid greeting exchange. The error text rarely says „wrong protocol.“ It says something about an unexpected response or a closed connection, and people chase certificates for an hour. The reverse mistake is just as common: IMAP on 995 fails the same way in the other direction.

Neither port has anything to do with sending. SMTP handles sending mail, on 587 for submission with STARTTLS or 465 for implicit TLS. A retrieval client that dials either one will connect successfully and then fail the protocol handshake, which is the subject of the next section. For now, the rule is simple: identify the retrieval protocol, then read the port off that protocol, not off whatever number the last tutorial you read happened to use.

Which Email Protocol to Use for Your Workflow

The protocol decision is really a decision about where the mailbox lives. IMAP keeps mail on the server and treats each client as a view into that store. POP3 downloads mail to a single client and, by default, removes it from the server. Everything else, including which port and SSL mode you configure, follows from that one architectural choice.

Start with device count. If two or more people or machines need the same inbox, IMAP is the only sane option. IMAP synchronizes folders and read states across devices, so a message marked read on a phone shows as read in the desktop client within seconds. IMAP uses encrypted port 993 with implicit TLS, which means the TLS handshake begins immediately on connect. No STARTTLS negotiation, no upgrade step that can be stripped by a misconfigured middlebox. POP3 supports inbox only. There are no server-side folders to sync, so a second device sees a different mailbox or nothing at all.

Next, retention. Ask where the authoritative copy must live. POP3 downloads mail to a single client, and unless you tick „leave messages on server,“ the server copy is deleted after retrieval. That is fine for a one-person mailbox on one laptop with local backups. It is not fine when a mailbox is the shared record of a project. IMAP keeps mail on the server, so retention is a server-side policy question, not a client-side accident. With IMAP, deleting a message in one client deletes it everywhere, which is either the feature you want or a data loss incident waiting to happen.

Mailbox size matters in both directions. Large archives favor IMAP if the server quota allows it, since you can search server-side and avoid pulling gigabytes onto a small disk. POP3 wins when the server quota is tiny and the client disk is large, because retrieval clears the server as it goes. Watch the numbers: many shared hosts cap mailboxes at 1 to 5 GB, and a POP3 client that stops retrieving because the inbox filled up is a common failure.

Criterion Choose IMAP Choose POP3
Devices Two or more, kept in sync One client, one operator
Folders Server-side folders and flags needed Inbox only is enough
Retention Server is the source of truth Local disk is the archive
Port and TLS 993, implicit TLS 995, implicit TLS
Server quota Needs headroom Can stay small

For either choice, verify the pairing before you commit. The incoming mail server role takes 993 for IMAP or 995 for POP3, both with implicit SSL. The outgoing mail server role is SMTP, which handles sending mail on 587 with STARTTLS or 465 with implicit TLS. Never point a retrieval client at 587, and never point a sending client at 993 or 995.

One more trap: catch-all email domains. If a domain routes every address to one mailbox, IMAP will sync that growing pile to every device. POP3 retrieval into a local store, or a tool that pulls and processes messages, often copes better with the volume. When weighing imap vs pop3 email, decide based on who needs to read the mail and where the copy must survive, then set the port to match.

POP3 for SEO Automation: Port and SSL Settings That Actually Work

Automation scripts get the port wrong more often than humans do, because the person who wrote the config copied a snippet from a tutorial and never looked at it again. For SEO automation that reads verification emails, password resets, or client replies, the correct retrieval endpoint is almost always POP3 on port 995 with implicit SSL. That pairing is defined in RFC 1939 for the protocol itself, and 995 is the encrypted variant. Point the script at 995, wrap the socket in TLS from the first byte, and authenticate. No STARTTLS negotiation step on that port: the handshake happens before the server sends its greeting banner.

Why POP3 and not IMAP for this job? Many SEO automation tools default to POP3 because the model is simple: connect, list, retrieve, delete, disconnect. There is no folder tree to reconcile and no read-state to track. POP3 supports inbox only, which is exactly what a script needs when it is harvesting messages sent to a catch-all domain like the ones AllMail provides for projects. One inbox, one consumer, no ambiguity about which message was already processed. The trade-off is that POP3 downloads mail to a single client, so if a human also opens that mailbox in a desktop client over IMAP, the two consumers will fight over the same messages. Pick one owner per mailbox.

The mistake to kill first: a script that opens a session to port 587 to fetch mail. Port 587 is SMTP submission, an outgoing mail server role. It expects the SMTP command set (EHLO, MAIL FROM, RCPT TO), not USER, PASS, and RETR. A retrieval client that connects to 587 will either hang waiting for a greeting it understands or get a 5xx protocol error after the first command. The same applies to 465, which is implicit-TLS SMTP submission. Both are for sending. Sending is handled by SMTP; receiving is handled by IMAP or POP3. Keep the two roles in separate config blocks so nobody swaps them.

Connection limits bite harder than people expect. Most providers cap concurrent POP3 sessions per mailbox at somewhere between 1 and 10, and some throttle by IP. A crawler that spins up 50 parallel workers, each opening its own POP3 session, will see 503 or „-ERR too many connections“ within seconds. The fix is a single connection with a worker pool behind it, or a small semaphore that caps sessions at 2 or 3. Also set explicit timeouts: 30 seconds for connect, 60 for read. A script that blocks forever on a dead socket stalls the whole pipeline and looks like a credentials problem when it is not.

A few settings worth hard-coding rather than leaving to defaults:

  • Port 995, implicit SSL, certificate verification on. Never disable verification to „make it work“.
  • Disable the „leave messages on server“ option unless you have a dedupe key. Otherwise the inbox grows until the provider throttles retrieval.
  • Delete after successful parse, not after download. A crash mid-parse should leave the message available.
  • Log the exact host, port, and TLS mode on every failure. Nine out of ten „auth errors“ are actually port errors.

Test the endpoint with openssl s_client -connect mail.example.com:995 before the first run. If you see the +OK greeting, the port and TLS mode are right, and any remaining failure is credentials or mailbox state.

A Checklist for Verifying Ports and SSL Before You Deploy

Run the role, protocol, port, encryption check in that order

Work through the four questions in sequence and stop at the first one that fails. Most broken setups skip a step and then chase symptoms in the wrong layer.

  1. Role. Is this connection receiving mail or sending it? Receiving means IMAP or POP3. Sending means SMTP. If the answer is „both,“ you have two connection blocks, not one.
  2. Protocol. IMAP if you need folders, read states, and email sync across devices. POP3 if you want mail pulled to a single client. For POP3 for SEO automation, this is almost always POP3, because the tool reads a mailbox and moves on.
  3. Port. Incoming mail server: IMAP 993 or POP3 995. Outgoing mail server: SMTP 587 with STARTTLS, or 465 with implicit TLS. Port 587 for retrieval is a hard fail, not a tuning issue.
  4. Encryption mode. Match the mode to the port. 993 and 995 expect implicit TLS from the first byte. 587 expects plaintext greeting then STARTTLS upgrade. Mixing the two produces handshake errors that look like certificate problems.

Write the result down as one line per connection, for example: incoming / POP3 / 995 / SSL. Anything ambiguous in that line is a bug waiting for the first deploy.

Probe the socket before the application does

Do not trust a UI toggle. Test the raw connection from the same network the app will run on, since corporate proxies and firewalls block ports silently.

  • telnet mail.example.com 995 should connect and immediately show a TLS banner attempt. A clean connect with no data usually means you are talking to a port that expects TLS and got a plaintext client.
  • openssl s_client -connect mail.example.com:993 -servername mail.example.com should complete the handshake and print the certificate chain. Check the expiry date while you are there.
  • openssl s_client -starttls smtp -connect mail.example.com:587 should upgrade cleanly. If this fails but 465 works, your client is set to implicit TLS on a STARTTLS port.
  • openssl s_client -connect mail.example.com:995 verifies the POP3 995 path end to end, including hostname matching on the certificate.

A quick sanity check on the receiving side: after connecting to 995 and authenticating, a POP3 server answers +OK. If you get an SMTP greeting such as 220 or an SMTP error mentioning relay, you are on a submission port and the protocol is wrong. That single response code catches the 587-for-incoming mistake faster than any log review.

Finally, confirm the account scope. IMAP exposes every folder the server carries, POP3 supports inbox only, and catch-all email domains on a project will dump unrelated addresses into that inbox. Run one real fetch, count the messages returned, and compare against what you expect. If the numbers disagree, fix the account or the protocol before you touch the port again.

Run the four checks in order before you point a client or script at a mailbox: role (incoming or outgoing), protocol (IMAP or POP3), port (993, 995, 587, or 465), and encryption mode (implicit TLS or STARTTLS). Write the result down as a single line per connection, for example „incoming / IMAP / 993 / implicit TLS“ or „incoming / POP3 / 995 / implicit SSL“ or „outgoing / SMTP / 587 / STARTTLS“. If you cannot fill in all four fields, the connection is not ready. A surprising share of „wrong password“ tickets close with a corrected port number and no credential change at all.

Then test the socket before you test the application. From a shell, openssl s_client -connect mail.example.com:993 -servername mail.example.com should complete a TLS handshake and print the server greeting; the same command against port 995 should behave identically for POP3. For submission, openssl s_client -starttls smtp -connect mail.example.com:587 proves that STARTTLS is offered on 587, while a plain telnet mail.example.com 587 should show a 220 banner and an EHLO reply that lists STARTTLS. If port 993 answers in plain text or refuses the handshake, the client is set to STARTTLS where implicit TLS is required. If 587 accepts a login but never lists a mailbox, you are talking to the outgoing mail server, not the incoming one, and no amount of retrying will fetch a message from it.

For automated inboxes, keep the retrieval path boring: one POP3 connection to port 995 with implicit SSL, a conservative poll interval, and a delete-after-download policy you have actually tested against your provider’s limits. Decide early whether messages stay on the server, because that setting determines whether a second device or a rerun of the script sees the same mail. If the workflow needs shared folders, read states, or several workers reading the same catch-all domain, switch to IMAP on 993 and handle folders explicitly. AllMail’s catch-all domains work with either protocol, so the port choice stays yours to make and to verify.

The concrete next step: open your configuration file, list every host, port, and encryption flag side by side, and delete or correct any entry that pairs 587 with a retrieval client, 993 or 995 with STARTTLS, or 465 with STARTTLS. Save the corrected matrix next to the deploy script so the next person does not repeat the mistake. Ten minutes of checking now beats a week of debugging a mailbox that was never listening on the port you chose.