title: sending mail from localhost using mail() function
body: <p>i am using Xampp on windows 7 and i am trying to send a mail using php mail() function to my gmail. (without using libraries like <a href="https://github.com/Synchro/PHPMailer" rel="nofollow"> Phpmailer</a>)</p>
  
  <p>i have tried using:</p>
  
  <ol>
  <li><p><strong>Mercury Mail</strong> - The script is not showing any errors and the mail() function actually          returns true </p></li>
  <li><p><strong><a href="http://www.toolheap.com/" rel="nofollow">Test Mail Server Tool</a></strong> - same issue as mercury mail</p></li>
  <li><p><strong><a href="http://glob.com.au/sendmail/" rel="nofollow">Fake Send mail</a></strong> - getting a "Connect timed out" error. </p></li>
  </ol>
  
  <p>These are my settings for Fake Send Mail :</p>
  
  <p><strong>sendmail.ini</strong></p>
  
  <pre><code>smtp_server=smtp.gmail.com
  smtp_port=587  (tried using 465)
  error_logfile=error.log
  debug_logfile=debug.log
  auth_username=fromname@gmail.com
  auth_password=pass
  </code></pre>
  
  <p><strong>php.ini</strong></p>
  
  <pre><code>sendmail_path = "\"E:\xampp\sendmail\sendmail.exe\" -t" has been commented out
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;?php
  
  $to      = 'toname@gmail.com';
  $subject = 'the the';
  $message = 'hello';
  $headers = 'From: fromname@gmail.com' . "\r\n" .
      'Reply-To: fromname@gmail.com' . "\r\n" .
      'X-Mailer: PHP/' . phpversion();
  
  mail($to, $subject, $message, $headers);
  ?&gt;
  </code></pre>
  
  <p>This is result of telnet smtp.gmail.com 587 :</p>
  
  <pre><code>220 mx.google.com ESMTP sb3sm19649093pac.14 - gsmtp
  451 4.4.2 Timeout - closing connection. sb3sm19649093pac.14 - gsmtp
  Connection to host lost.
  </code></pre>
  
  <p>i have gone through similar questions in this forum but it's still not working for me.</p>
  
  <p><strong>What is it that i am missing here and could you provide me the links for any other tools that i should try? Thanks..</strong></p>