How to secure postfix so the ISP won’t block it

emailpostfixsmtp

Our dev server is a CentOS LAMP system for developing web sites. We want PHP to send email. The server doesn't need to receive email or anything else, literally just send email to our developers.

I read about nullclients and how they can drop in instead of postfix, but I didn't fancy using something not in a repository. After a little fiddling I got postfix to (try) send email, by using settings similar to those found in the Postfix on a null client instructions on the Postfix Standard Configuration Readme:

myhostname = localhost.localdomain
myorigin = localdomain
relayhost = $mydomain
inet_interfaces = loopback-only
mydestination =

Once I set it up like this, I tried to send an email with telnet and saw the following error from /var/log/maillog:

Apr 23 19:26:25 devserver postfix/smtp[34437]: 604E95209C3: to=<user@domain.co.uk>, relay=localdomain[82.147.22.3]:25, delay=0.54, delays=0.07/0/0.07/0.41, dsn=5.0.0, status=bounced (host localdomain[82.147.22.3] said: 550-Please turn on SMTP Authentication in your mail client, or login to the 550-IMAP/POP3 server before sending your message.  ourstatic.hostname.isp.co.uk (localhost.localdomain) 550-[123.456.789.0]:54710 is not permitted to relay through this server 550 without authentication. (in reply to RCPT TO command))

So presumably our ISP will allow email being sent, but it must be authenticated. Does this mean with them or with the server we're trying to send email to? I've read about SASL with postfix but I'm not sure if that's the route I should go down.

Please provide suggestions or further reading, including whether you think there is a better alternative altogether. More information I've missed I'll be glad to share.

Update

In reply to some of the comments – I am not trying to relay through my ISP, but when I use postifx on the dev server to try send an email, the above is what I see, so presumably the ISP is blocking it.

Something I forgot to add, which confuses me further. We were previously using WampServer and had an install of hMailServer on our machines which was setup with SMTP only. Sending email via this (with Windows SMTP settings in php.ini) worked fine and we had no issues with this relay message. I have no idea why the difference now we're trying to use postfix.I see that hMailServer acts as an SMTP server – which is exactly what I want to do with postfix.

As for having an internal mailserver in the company, we do have one in a different office but we don't want to route email elsewhere – we just want to have a way for the PHP to send email to just the devs without affecting production services if anything went wrong (like blacklisting or something).

Maybe my setup is wrong in that postfix/my ISP think I'm trying to use them as a relay, when all I want to do is have a simple SMTP functionality via postfix to send an email. Any further suggestions?

Best Answer

Unless you have set postfix up with a relayhost most likely thing here is that either you are sending to addresses on the same isp and their mailserver sees you as in their network and needing to be authenticated, or they capture all traffic on port 25 and redirect it to their own mail server (which is common but somewhat evil IMHO).

The solution to both cases is to set postfix to use your ISP mailserver as a relayhost with authentication. Such configuration is well documented in postfix's manual.