Have an SMTP server setup running in postfix, only for sending mails . Now the requirement is i want to relay mails for particular domain to end user through other SMTP , without disturbing default setup (i.e, without relaying)

Existing Setup

   Application -->  My SMTP  ---> End user

Required for particular domain to send mails

 Application ( [email protected] ) --> My SMTP  --> SMTP of XYZ.com

1 Answer 1


If you want to send to a server other than what say the MX records in DNS for a domain, you can add a line in /etc/postfix/transport:

abc.com        smtp:mail.xyz.com

Then run postmap /etc/postfix/transport.

If it isn't already, add transport_maps = hash:/etc/postfix/transport to /etc/postfix/main.cf and run postfix reload.

  • Thankx Cakemox, but how can i confirm whether the mails from abc.com using my SMTP as origin and mail.xyz.com as RELAY .. any logs to identify Apr 9, 2011 at 17:00
  • Postfix uses the mail facility of syslog which usually goes to /var/log/mail.log
    – Cakemox
    Apr 9, 2011 at 17:37
  • Whether the mail.xyz.com want to allow accept abc.com as relay in their server. Pls clarify Apr 10, 2011 at 4:53
  • 1
    +1 for this answer. Additionally, you can specify via IP address by using smtp:[ip.add.re.ss]. The [] suppresses MX lookups and forces the system to try to send to whatever destination you've specified. postfix.org/transport.5.html Apr 14, 2011 at 19:50
  • 3
    Is there any way to specify a username and password for the relays for those cases when a relay requires SMTP AUTH? Dec 12, 2017 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .