Mail proxy subsystem
Mail proxy is not a mail server
Nginx can accept mail client connections, consult an external authentication service and forward a session to a selected mail backend. It does not provide a mailbox store, queue, spam filtering pipeline or complete mail transfer agent. SMTP sends or transfers messages; IMAP accesses and manages mail on the server; POP3 retrieves mail. A mail system must supply the actual delivery and storage independently. The following drawing uses fictional services, not an address to contact.
Mail client → Nginx mail listener → mailbox or SMTP backend ↓ private authentication serviceSelect the protocol explicitly
The mail block belongs at main configuration level, beside events and http, not inside http. Each mail server selects one protocol; high custom ports do not identify the protocol automatically. The example is a partial configuration showing separate endpoints. It requires the mail module and a reviewed private authentication service; do not start it as written because TLS has not yet been added.
mail { auth_http http://127.0.0.1:19380/auth; server { listen 127.0.0.1:19381; protocol imap; } server { listen 127.0.0.1:19382; protocol pop3; } server { listen 127.0.0.1:19383; protocol smtp; }}Understand protocol capabilities
Mail clients discover commands through protocol-specific exchanges. The advertised extensions must agree with the backend, especially commands used after handoff. These inert examples illustrate capability discovery; they are not a full conversation or a server to deploy. SMTP submission and server-to-server transfer have different policy requirements. Never create an unauthenticated relay as a learning shortcut.
IMAP: a1 CAPABILITYPOP3: CAPASMTP: EHLO client.testCheck availability before writing configuration
A mail build may be static or dynamic. A dynamic build needs the matching installed module and a load_module directive in main context. Verify the actual package and build, not only the online documentation. The observed local 1.26.3 binary has a dynamic mail build option but no module directory; no mail syntax or runtime tests can be claimed.
nginx -vnginx -V# Inspect the approved package manifest for its mail module.Practice and next steps
Practice: Draw SMTP submission, IMAP retrieval and POP3 retrieval through a mail proxy; label auth and mailbox/delivery responsibilities. Next lesson: nginx-mail-tls-and-authentication-service.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Mail proxy subsystem
Identify mail protocol roles and authentication boundary
Which protocol is primarily used to access and manage server-side mail?
Where does the mail block belong?
What does Nginx mail proxy not supply?
Why specify protocol on a custom port?
What does a dynamic build require?