title: Issues in connecting phpmailer with Office365
body: <p>I need to send email using Office365 mail server from may webpage where user enters their email address.My configurations are as follows:</p>
  
  <pre><code>        require("phpMailer/PHPMailerAutoload.php");
          $mail = new PHPMailer(true);
          $mail-&gt;CharSet = 'UTF-8'; 
          $mail-&gt;isSMTP();
          $mail-&gt;SMTPDebug    = 1;
          $mail-&gt;Debugoutput  = 'html';
          $mail-&gt;Host         = 'smtp.office365.com';
          $mail-&gt;Port         = 587;
          $mail-&gt;SMTPAuth     = true;
          $mail-&gt;Username     = trim($username);//username 
          $mail-&gt;Password     = trim($password);//password
          $mail-&gt;SMTPSecure   = 'tls';  
          $fromName = 'Test';
          $from     = $myemail;    
          $mail-&gt;AddReplyTo($from, $fromName);     
          $mail-&gt;From         =   $from;  
          $mail-&gt;FromName     =   $fromName;
          $mail-&gt;AddAddress($semail);//mail_id which i need to send mail                                               
          $mail-&gt;WordWrap     =   80; // set word wrap   
          $mail-&gt;MsgHTML($_body);                
          $mail-&gt;IsHTML(true); // send as HTML 
  </code></pre>
  
  <p>When I run the page,it gives following error message</p>
  
  <pre><code>Connection: opening
  SMTP ERROR: Failed to connect to server:
  php_network_getaddresses: getaddrinfo failed: 
  Name or service not known (0)
  SMTP connect() failed.
  **Fatal error**: Uncaught exception 'phpmailerException' with message 
  'SMTP connect() failed.
  </code></pre>
  
  <p>When I use gmail server configuration details(<strong>host:smtp.gmail.com)</strong> ,this is working fine.But my client mail server is with Office365.</p>