Tuesday, April 28, 2009

Postfix relay messages to different port

A frequent occurrence in applications is to send out emails. In order to test that behavior sufficiently during development, I usually use one of two options. On Windows you can use Mailster (preferred) or you can use postfix etc. on Mac/Linux (Have not been able to get Mailster going on my Mac)

So far on my Mac until recently it was as easy as to simply do: sudo postfix start and I was good to go. Unfortunately, my domain hoster does not accept mail on port 25 anymore. And the simple relay stopped working.

As it turns out though, you can easily relay to a different port (My hoster accepts port 26):

sudo vi /etc/postfix/main.cf
I added a line (near # INTERNET OR INTRANET):

relayhost = myHost.com:26

And finally I reloaded my postfix configuration using sudo postfix reload and I was back in business once again.

No comments: