none
How to Setup MICROSOFT ONLINE OFFICE 365 with PHPMailer via SMTP for Sent Email on a linux enviroment. RRS feed

  • Question

  • Hi there,
    We change our server to  Office 365 Mail Exchange online, and i'm trying to setup a connection via SMTP with PHPmailer for our website in the section of "contact us", our server is a linux distribution and i'm not able to connect to the server i already create a  SPF record for allow my ip address to sent email and by the way i have set up properly the phpmailer.

    $mail->SMTPAuth = true;     // turn on SMTP authentication
    $mail->SMTPSecure = "TLS";
    $mail->Host     = "smtp.office365.com";
    $mail->Username = "angel@pvrpv.com";
    $mail->Password = "THEPASSWORDCODE";
    $mail->Port        = 587;
    If you have any help. i guess i need to setup something at the office365 to allow the ip address of my server by able to send the email from an outside server, 'cause i was able to connect me throw Outlook PC via SMTP. but surelly it brings some configuration to allow those kind of connection.
    Thank you in advance
    Monday, June 3, 2013 5:04 PM

All replies

  • Hi,

    Take a look at:

    "How to set up an SMTP relay in Office 365" http://support.microsoft.com/kb/2600912?wa=wsignin1.0

    Oliver


    Oliver Moazzezi | Exchange MVP, MCSA:M, MCITP:Exchange 2010,MCITP:Exchange 2013, BA (Hons) Anim | http://www.exchange2010.com | http://www.cobweb.com | http://twitter.com/OliverMoazzezi

    Tuesday, June 4, 2013 10:26 AM
  • Hello Luckye_boss,

    From what I can tell your only problem is the uppercase TLS.  I used almost exactly your code and was able to get it working without any settings on Outlook 365, or any crazy SMTP Relay as Oliver suggests: 

    $mail->SMTPAuth = true;     // turn on SMTP authentication

    $mail->SMTPSecure = "tls";
    $mail->Host     = "smtp.office365.com";
    $mail->Username = "angel@pvrpv.com";
    $mail->Password = "THEPASSWORDCODE";
    $mail->Port        = 587;

    This works for me!

    Thursday, October 24, 2013 5:43 PM