title: Unable to send SMTP mail() from localhost
body: <p>I m try to send mail from my localhost but it not work fine . I am given my code below . please have a look at the below code and please tell what the actual problem is . Thanks </p>
  
  <p>mail Function I Used -></p>
  
  <pre><code>[mail function]
  ; For Win32 only.
  ; http://php.net/smtp
  SMTP = SMTP
  ; http://php.net/smtp-port
  smtp_port = 25
  
  ; For Win32 only.
  ; http://php.net/sendmail-from
  ;sendmail_from = NULL
  
  ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
  ; http://php.net/sendmail-path
  ;sendmail_path = NULL
  
  ; Force the addition of the specified parameters to be passed as extra parameters
  ; to the sendmail binary. These parameters will always replace the value of
  ; the 5th parameter to mail(), even in safe mode.
  ;mail.force_extra_parameters = NULL
  
  ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
  mail.add_x_header = Off
  
  ; Log all mail() calls including the full path of the script, line #, to address and headers
  mail.log = "D:\xampp\apache\logs\php_mail.log"
  </code></pre>
  
  <p>php code Used -></p>
  
  <pre><code>    &lt;?php
  $to = "somebody@example.com, somebodyelse@example.com";
  $subject = "HTML email";
  
  $message = "
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;HTML email&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;p&gt;This email contains HTML Tags!&lt;/p&gt;
  &lt;table&gt;
  &lt;tr&gt;
  &lt;th&gt;Firstname&lt;/th&gt;
  &lt;th&gt;Lastname&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;John&lt;/td&gt;
  &lt;td&gt;Doe&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  ";
  
  // Always set content-type when sending HTML email
  $headers = "MIME-Version: 1.0" . "\r\n";
  $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
  
  // More headers
  $headers .= 'From: &lt;webmaster@example.com&gt;' . "\r\n";
  $headers .= 'Cc: myboss@example.com' . "\r\n";
  
  mail($to,$subject,$message,$headers);
  ?&gt;
  </code></pre>
  
  <p>Getting error When Execute PHP code Above-></p>
  
  <pre><code>Warning: mail() [function.mail]: Failed to connect to mailserver at "SMTP" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\xampp\htdocs\mail.php on line 43
  </code></pre>
  
  <p>Thanks In Advance.</p>