phpmailer没有发送电子邮件

时间:2013-09-30 07:33:00

标签: php phpmailer

我有一个phpmailer的问题,它返回true但邮件没有交付.. 这是我的代码。

require_once('class.phpmailer.php');
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 2; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->Host = "smtp.postmarkapp.com";
$mail->Port = 25; // or 587
$mail->Username = "XXXXXXXXX";
$mail->Password = "XXXXXXXXXXXX";
$mail->SetFrom("sudeep777@hotmail.com");
$mail->Subject = "Test";
$body = "its a test message";
$mail->AddAddress("sudeep777@gmail.com");
$mail->MsgHTML($body);
if (!$mail->Send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message has been sent";
}

It simply returns:


SMTP -> FROM SERVER:220 smtp.postmarkapp.com ESMTP aws-dub-smtp1
SMTP -> FROM SERVER: 250-smtp.postmarkapp.com 250-PIPELINING 250-SIZE 20480000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5 250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN
SMTP -> FROM SERVER:250 2.1.0 Ok
SMTP -> FROM SERVER:250 2.1.5 Ok
SMTP -> FROM SERVER:354 End data with .
SMTP -> FROM SERVER:250 2.0.0 Ok: queued as 0AE8D259B4

消息已发送

为什么不发送电子邮件?

1 个答案:

答案 0 :(得分:0)

试试

$mailer->Port=465;
$mailer->SMTPSecure="ssl"; //If this doesn't work, try 'tls'