Virtual SMTP servers with a Postfix Relay - Ubuntu Forums

Virtual SMTP servers with a Postfix Relay

Did you try:

relay_domains = example.com, example.net

and also something you need to know.
you dont need to set the mx record as in the same domain your want it to work for.
let say you need example.net and example.com to be relayed using 80.80.80.80
you are making an A record in the name let say smtp.relayserver-domain.com
and in the mx records of the other domains you set theĀ smtp.relayserver-domain.com
as your mx record.

and second thing you must do is to permit relaying using in theĀ main.cf

relay_domains = example.com, example.net

transport_maps = hash:/etc/postfix/transport

in this file add the records for each domain smtp server
/etc/postfix/transport

example.com smtp:[smtp.example.com]

example.net smtp:[smtp.example.net]

and run the command
postmap hash:/etc/postfix/transport

this way the server is bound to do a dns lookup only for the smtp.example.com and not to the mx record of the domain.

[ubuntu] Virtual SMTP servers with a Postfix Relay – Ubuntu Forums.