2016-09-13 5 views
-1

私はメールコードを使用して、他のサーバでメールを送信しています。しかし、特定の新しいサーバーでは、私はメールを送信するためのSMTP認証を追加する必要があります 私は多くの後に書いた以下のコードは& D メールを送信できません。SMTP AUTHを使用してPHPでメールを送信

$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>"; 
} 

答えて

関連する問題