SEND MAIL IN PHP USING SMTP AUTH
<p>I have been using mail code to send the mails in other server without any fail. But for a particular new server , i require to add SMTP authorization to send mail
Here is the below code i wrote after lot of R&amp;D.
Still I am unable to send mail.</p>

<pre><code>$new = "Hi, This is Test mail";
$new .= "&lt;/table&gt;&lt;table width=\"100%\" align=\"left\" border=\"0\" bordercolor=\"#000000\" cellpadding=\"0\" cellspacing=\"0\" class=Head&gt;                                                                                                  

            &lt;tr&gt;&lt;Td colspan=3&gt;&lt;strong&gt;This is system generated mail,Please do not respond&lt;/strong&gt;&lt;/Td&gt;&lt;/tr&gt;
            &lt;tr&gt;&lt;Td colspan=3&gt;&lt;strong&gt;Thanks&lt;/strong&gt;,&lt;/Td&gt;&lt;/tr&gt;
            &lt;/table&gt;

    &lt;/head&gt;
    &lt;/body&gt;
    &lt;/html&gt;";

echo $new;  


    $to= "&lt;omg@gmail.com&gt;;\r\n";
$subject = "Test Mail";
$host ='xyz.com';
$username='abc@gmail.com';
$password='89393@998';

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= "From:TEST MAIL CRM&lt;abc.gmail.com&gt;\r\n";
    //$headers .= "Bcc:&lt;dd@gmail.com&gt;\r\n";


if(isset($_REQUEST['sendmail'])){
echo $to;
mail($to, $subject, $new, $headers);
    echo "&lt;h1&gt;Mail Send Successfully&lt;/h1&gt;";
}
</code></pre>