title: Getting error in smtp in php
body: <p>I wish to send an email from my localhost with a valid smtp server. How should I configure the xampp server?
  Here is my setup:</p>
  
  <pre><code>&lt;?php
  $mail-&gt;isSMTP();                           
  $mail-&gt;Host = 'smtp.example.com'; 
  $mail-&gt;SMTPAuth = true;   
  $mail-&gt;Username = 'myusername'; 
  $mail-&gt;Password = 'my password'; 
  $mail-&gt;Port = 587; 
  $mail-&gt;From = 'noreply@mysite.com';
  $mail-&gt;FromName = 'mysite';
  $mail-&gt;addAddress($email, $email); 
  $mail-&gt;isHTML(true); 
  $mail-&gt;Subject = 'Reset your Password';
  $mail-&gt;Body    =  $content;
  $mail-&gt;AltBody = $content;
  $mail-&gt;SMTPSecure='tls';
  ?&gt;
  </code></pre>
  
  <p>I'm getting error:</p>
  
  <blockquote>
    <p>error:"called HELO without being connected".</p>
  </blockquote>
  
  <p>All variables are set, but I left some out to shorten the question.</p>