PHP邮件错误:SMTP错误

Sha*_*s88 1 php

我正在使用php邮件程序类.我收到:SMTP错误:以下收件人失败:s_deshmukh88@hotmail.com

$mail = new phpMailer();
$body             = "Hello, this is a test mail.";
//$body             = preg_replace('/\\\\/','', $body); //Strip backslashes

$mail->IsSMTP();                           // tell the class to use SMTP
//$mail->SMTPAuth   = true;                  // enable SMTP authentication
//$mail->Port       = 25;                    // set the SMTP server port
$mail->Host       = "localhost";           // SMTP server
$mail->Username   = "localhost";     // SMTP server username
$mail->Password   = "password";            // SMTP server password
//$mail->SMTPSecure   = "tls";
//$mail->IsSendmail();  // tell the class to use Sendmail

$mail->AddReplyTo("name@domain.com","First Last");

$mail->From       = "name@domain.com";
$mail->FromName   = "First Last";

$to = "s_deshmukh88@hotmail.com";

$mail->AddAddress($to);

$mail->Subject  = "First PHPMailer Message";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap   = 80; // set word wrap

$mail->MsgHTML($body);

$mail->IsHTML(true); // send as HTML

if($mail->Send()){
    echo 'Message has been sent.';
    }
Run Code Online (Sandbox Code Playgroud)

可能是什么原因?

小智 5

只是尝试将SMTPAuth设置为false并将Host设置为"本地主机".

谢谢 !!:)