-1

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&D. Still I am unable to send mail.

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

            <tr><Td colspan=3><strong>This is system generated mail,Please do not respond</strong></Td></tr>
            <tr><Td colspan=3><strong>Thanks</strong>,</Td></tr>
            </table>

    </head>
    </body>
    </html>";

echo $new;  


    $to= "<omg@gmail.com>;\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<abc.gmail.com>\r\n";
    //$headers .= "Bcc:<dd@gmail.com>\r\n";


if(isset($_REQUEST['sendmail'])){
echo $to;
mail($to, $subject, $new, $headers);
    echo "<h1>Mail Send Successfully</h1>";
}
Amlan
  • 129
  • 1
  • 2
  • 14

1 Answers1

-1

https://github.com/PHPMailer/PHPMailer use this lib, there is also good example : https://github.com/PHPMailer/PHPMailer/blob/master/examples/smtp.phps