Need to send mail from our FQDN IP

Zak asked:

I am trying to wrap my hear around how I am going to get around this latest hurdle. What needs to happen: PHP script sends email to our Exchange Server ….

Sounds simple right? Well the issue is that the LAMP server that has the PHP script on it is located in our office building, while our web server is hosted at a dedicated hosting company IP 65.xxx.xxx.xxx. When we send the email to our exchange server (hosted by Office 365) from the office based PHP script IP 173.xxx.xxx.xxx, the exchange server pings-back the domain that the email came from only to find that the IP the domain resolves to is our web server IP 65.xxx.xxx.xxx … and not the office 173.xxx.xxx.xxx (which the email originated from) It compares, they don’t match .. and trash goes the email.

What methods can I use to get that email sent out with the 65.xxx.xxx.xxx IP so that the exchange server doesn’t block it? I was thinking possibly having PHP SSH into the web server and use it’s (the web server’s) sendmail? Or do I remove sendmail on the office maching and use postfix to TLS into our exchange account? I have never dealt with this. ANY help, advice, web articles — anything that points me to a viable solution would be appreciated!

My answer:


Office 365 has a feature where it can act as a relay for your internal office mail servers, but it’s only available on the enterprise plans ($8/user and up).

Your best bet here, assuming you don’t want to spend a lot more money, is to create a user account ($4) and have your local mail server(s) authenticate to it. Sendmail and postfix are both capable of authenticating to a remote SMTP smart host.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.