2013-04-20 35 views
0

发送电子邮件,我尝试使用发送电子邮件以下PHP code.But我得到以下错误:需要身份验证错误,而使用PHP

警告:电子邮件():SMTP服务器响应:530-5.5.1需要身份验证。了解更多信息至530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257

<?php 
    $to = "[email protected]"; 
    $subject = "Test mail"; 
    $message = "Hello! This is a simple email message."; 
    $from = "[email protected]"; 
    $headers = "From:" . $from; 
    mail($to,$subject,$message,$headers); 
    echo "Mail Sent."; 
?> 
+0

http://stackoverflow.com/questions/11477902/mail-php-smtp-authentication-issue的可能重复 – 2013-04-20 07:25:11

回答

0

这很明显,您的SMTP服务器需要您进行身份验证。使用更强大的工具发送邮件,例如PHPMailer。