Request for some smtp example with and without auth

Anton Yuzhaninov citrin at
Sat Apr 4 01:51:40 MSD 2009

Atif Ghaffar wrote:
> Dear all,
> For pop and imap its pretty clear and I have documented on the wiki.
> Can someone please state a short example on how nginx smtp proxy works 
> with a smtp server.
> The documentation on this is very sparse, If you can forward me to the 
> right direction, I will write myself the documentation on the wiki.
> Withougt authenticatin (MX)
> * Is it possible to mutiplex to different real smtp servers (If not, its 
> fine, LVS can do that job)

Nginx send request by http to defined in config server and this server can return ip of 
differend upstreams. So load balancing can be done by this "auth" server.

> * Is is possible to do something with the header before forwarding the 
> request to the real smtp sever. (How can real smtp server do RBL checks 
> if the IP address is local)

Nginx can say to real smtp server about client's ip via XCLIENT command:
xclient also can be used with patched exim:

Also RBL check can be performed by nginx+http server.
Example of such server is:
(works with pathed libevent:

> * What can nginx do before sending the connection the the smtp server 
> (Can it change/add some headers, can in pass the mail through a filter)?

No, nginx can't change message.

> With Authentication
> Same questions as above. A short example (even in pseudo code) will be 
> very helpful.

Auth server works as for pop3/smtp. Additional header in response can be added for bad replays 
- Auth-Status - it used as smtp error code.

May be the main reason to use nginx as smtp auth proxy - to share auth server with pop3/imap.

> What to look out on the real  smtp server?
> Does the actual IP goes to the real smtp server?

MTA can know client's IP also from XCLIENT command.

  Anton Yuzhaninov

More information about the nginx mailing list