title: how to send mail using phpmailer with smtp.office365.com
body: <p>I am using below code to send mail but this is not working for me. Please help me to resolve this problem.</p>
  
  <pre><code>require 'class.phpmailer.php';
  require 'class.smtp.php';
  $subject="Test PHP mailer";
  $message="Hi";
  
  $mail   = new PHPMailer();
  $mail-&gt;IsSMTP();
  $mail-&gt;SMTPAuth   = true;                  // enable SMTP authentication
  $mail-&gt;SMTPSecure = "tls";                 // sets the prefix to the servier - TLS/SSL
  $mail-&gt;Host       = "smtp.office365.com";      // sets GMAIL as the SMTP server - smtp.gmail.com
  $mail-&gt;Port       =  587;                   // set the SMTP port for the GMAIL server - Gmail SMTP port (SSL): 465 **** Gmail SMTP port (TLS): 587
  $mail-&gt;Username   = "";  // other email address
  $mail-&gt;Password   = "";            // password
  $mail-&gt;SetFrom("customercare@test.com", "John");
  $mail-&gt;addReplyTo('customercare@test.com', 'John');
  $mail-&gt;Subject    = $subject;
  //$mail-&gt;IsHTML(true);
  $mail-&gt;MsgHTML($message);
  $mail-&gt;AddAddress('abc@example.com');
  if (!$mail-&gt;send()) {
      echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  } else {
      echo "Message sent!";
  }
  </code></pre>
  
  <p>It display error message:</p>
  
  <p>Mailer Error: SMTP Error: data not accepted.SMTP server error: DATA END command failed Detail: 5.7.60 SMTP; Client does not have permissions to send as this sender SMTP code: 550</p>