Postfix - Relay each outbound email via different SMTP server

Hi Guys

Is it possible to configure Postfix to relay eamail for each virtual host via a different server? We have several domains which need their email sent via a 3rd party (Messagelabs), but we have others that need to be sent direct.

If this is possible, could anybody offer advise on how its done?



So you’d like outbound email to go through a specific server?

You can configure that by going into Webmin -> Servers -> Postfix -> General Options, and setting your relay host in the field “Send outgoing mail via host”.


Sorry to nudge an old thread but I have come to this thinking I am wondering about the same issue.


I have tested the “Send outgoing mail via host” option in the Postfix Config and it works. But, it is global and works for each Vritual Server I have on this box (Ubuntu 10.04). Is there a way to allow some of the virtual servers to send via the external SMTP host (gmail in my case) while lettings others go through the default “direct” option?

I am also looking for a way to configure some of the virtual servers to send outgoing mail via an external SMTP host (like sendgrid) while lettings others go through the default “direct” option. I tried to search but could not find a solution.

For Postfix 2.7 and later, sender_dependent_default_transport_maps

for Postfix 2.3 and later, I think you have to use sender_dependent_relayhost_maps and list your domains in $relay_domains

These would be edit’s to the postfix file