Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
And which Office 365 service do you have? –  Michael Hampton Jan 9 '13 at 1:44
We have the $4 per person Exchange Service -- –  Zak Jan 9 '13 at 16:04
Really? If you are going to vote my question down, at least have the decency to comment about the downvote so that I can improve my question. it's easy to hit a check box, but so hard to type a message? Should be a requirement on stack sites ... –  Zak Jan 9 '13 at 16:13

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
Is Sendmail able to authenticate using TLS? I believe that is the authentication used by Office 365. –  Zak Jan 9 '13 at 16:12
I have looked -- For future reference, and those it can help, Office 365 is TLS on port 587. Sendmail is able to communicate this way through SMTP. @Michael's method is the best solution if you don't want to spend the money. –  Zak Jan 9 '13 at 16:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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