emailsmtppowermta

PowerMTA: How to forward messages to external SMTP servers


We have a PowerMTA server that receives incoming e-mail. Is it possible to forward specific domains to another existing SMTP server that's not running PowerMTA?

The solution that I found so far is to pipe the e-mails to mailx that's pointing to another SMTP server, but this looks hack-ish.

Thanks!


Solution

  • This is an example for routing gmail.com to SendGrid. You might need to uncomment use-unencrypted-plain-auth for some SMTP providers.

    <domain gmail.com>
        queue-to sendgrid.rollup
    </domain>
    
    <domain sendgrid.rollup>
    #   use-unencrypted-plain-auth yes
        auth-username username
        auth-password password
        route smtp.sendgrid.net:587
        use-starttls yes
        require-starttls yes
    </domain>
    

    You might want to use virtual-mta and virtual-mta-pool if you are looking to use multiple SMTP providers to load balance outgoing emails. Let me know and I will update answer with its configuration.