Link to home
Start Free TrialLog in
Avatar of regmandy
regmandy

asked on

PHPmailer and exchange online(Office365)

Hey guys,

I'm having an issue where we've recently upgraded to exchange online(office365) and even tho I updated the PHPmailer info on my Ubuntu server, now my web server will not send email.  I've gone through and checked the necessary settings and configured it using the following Technet article.
https://technet.microsoft.com/en-us/library/dn554323.aspx

in the webapp I'm using the following code.

$mailer = new PHPMailer();
$mailer->SMTPSecure = "tls";
$mailer->Host              = "smtp.office365.com";
$mailer->Port               = "587"; also tested with 25
$mailer->Username    = "Authenticated username";
$mailer->Password     = "password for said authen user";
$mailer->IsSendMail();
$mailer->SetFrom("noreply@domain.com");
$mailer->Subject = "subject";
$mailer->MsgHTML("message");

What I'm seeing in the mail.log of my server are 2 errors.  
Valid_hostname: Invalid Character 92 (decimal): \032controlsequipment-com.mail.protection.outlook.com\032
malformed domain name in resource data of MX record for controlsequipment.com: \032controlsequipment-com.mail.protection.outlook.com\032

Based on these messages, I'm assuming the error is due to the dash in the MX record which is a copy and paste from the Exchange online Domain records list.  I've called M$ and they've said that is the proper configuration.

So my question is, how do I get around it with my web app?  I've gone through a bunch of resources on how to configure it but I have the exact same configuration and none of the resources I've gone to mention getting the errors above.   I'm at a loss right now what my next step is.
ASKER CERTIFIED SOLUTION
Avatar of Marcus Bointon
Marcus Bointon
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of regmandy
regmandy

ASKER

excellent thanks.  I'm not a coder, the application analyst is the one who wrote the app and initially it was an on premise exchange server that that code worked with.  Since we switched to exchange online, it stopped working.  

I'll update PHPmailer to the latest version and go through the documentation to see if I can correct the code.   so the \ is the issue not the dash.  thanks.  I'll report back with an update once I've gone through the provided resource.