SMTP Forward Nginx Proxy
Maxim Dounin
mdounin at mdounin.ru
Thu Nov 26 13:51:25 UTC 2015
Hello!
On Wed, Nov 25, 2015 at 05:27:09PM -0500, chobit wrote:
> Almost all of our customers send e-mail through our private SMTP servers,
> but we have one customer who chooses to use a third-party SMTP provider. The
> third-party SMTP service requires whitelisting of any sending IP addresses
> which is normal.
> Unfortunately the components in our infrastructure which send e-mail are
> part of an autoscaling group so the IP addresses can vary.
> To solve for this problem I would like to setup an nginx configuration which
> accepts SMTP connections to it and then proxies them to another IP address
> (the third-party SMTP service) so the requests to the mail server always
> appear to the third-party SMTP service as if they came from the same
> server.
>
> Is it possible to solve this issue with ngingx smtp proxy?
> How should i forwarded smtp in case with third-party SMTP service?
You can configure nginx mail proxy to forward all connections to a
particular SMTP server. To do so, return server IP addresss from your
auth_http service, see http://nginx.org/r/auth_http.
Note though, that nginx is not designed to talk to 3rd party
servers, it is designed to proxy to your own backends. In
particular, in case of SMTP this results in the fact that no auth
commands are sent to backend servers - they are expected to be
configured to accept mail without authentification. Depending on
a particular 3rd party service you are trying to use, this may or
may not be an option.
For your particular task, it may be easier to configure raw TCP
proxy to a particular 3rd party SMTP server (e.g., using nginx
stream proxy, http://nginx.org/en/docs/stream/ngx_stream_core_module.html)
or a full-featured STMP server with a smarthost configured.
--
Maxim Dounin
http://nginx.org/
More information about the nginx
mailing list