SNI like equivalent for starttls

smtpstarttls

I am trying to host two seperate domains on one IP address. I want to be able to determine from the STARTTLS command which certificate was being requested and forward to a different mail server based on the domain.

This doesn't seem to be possible from the RFCs, but is there any other way something like this can be achieved on the single IP address?

Best Answer

no, SMTP is designed to have the entire email communication path traced in the email and each connection would terminate and relay the email, you should use transport maps (for postfix) to control the destination by email address not MTA hostname.

If you are receiving email for both domains locally then your email server should handle that, if this single IP is forwarding email to two other servers internally, then transport maps are what you are looking for in terms of a postfix server.

If this is an outbound server relay (SMTPS), you would need to handle authentication for both domains at this server as you cannot "proxy" like you do with nginx/haproxy and SNI.