I'm trying to set up a Postfix server on Google Cloud, which blocks outgoing SMTP ports. My problem is that one email address (say alias@example.com) needs to be an alias for an external email address (foo@example2.com); all emails sent to alias@example.com need to be forwarded to foo@example2.com. I also have other email addresses that simply need to be delivered locally.

I am able to get Postfix to attempt to send all emails to alias@example.com to foo@example2.com using virtual alias mappings, but because SMTP ports are blocked, the connection doesn't go through to example2.com's SMTP server. I want to get Postfix to send these emails through Mailjet on port 2525 so that the connection isn't blocked. Unfortunately, even when relayhost is set to in-v3.mailjet.com:2525, Postfix doesn't attempt to relay the emails and instead tries to send them directly.

I'm on Ubuntu 16.04.


When you do any relay directive, postfix by default will try to lookup the mx for that domain, so you have to tell postfix to use the a-record provided using brackets, see my relayhost directive below.

relayhost = [vps1.domain.com]:26

I'm using an off port to get around my ISP blocking smtp, so this forces postfix to go straight to that a-record and connect to send email.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.