2016-09-13 3 views
-1

Ich habe Mail-Code verwendet, um die Mails in anderen Server ohne Fehler zu senden. Aber für einen bestimmten neuen Server, ich benötige SMTP-Autorisierung zum Senden von E-Mail Hier ist der folgende Code ich schrieb nach viel R & D. Noch kann ich keine E-Mails senden.SEND MAIL IN PHP mit SMTP AUTH

$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= "<[email protected]>;\r\n"; 
$subject = "Test Mail"; 
$host ='xyz.com'; 
$username='[email protected]'; 
$password='[email protected]'; 

$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:<[email protected]>\r\n"; 


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

Antwort