我正在写一个脚本来发送一些邮件。运行脚本时,我收到一条成功消息,并显示从我的Gmail帐户发送的电子邮件,但我没有收到我的hotmail帐户中的电子邮件。我已经检查了所有可能的位置(垃圾邮件,垃圾邮件等)我在EC2上使用Bitnami堆栈。 Apache错误日志显示没有错误。
<?php
// Pear Mail Library
require_once "Mail.php";
$from = '<myaddress@gmail.com>'; //one of my addresses
$to = '<myaddress@live.com>'; // another address of mine at hotmail
$subject = 'Hi!';
$body = "Hi,\n\nHow are you?";
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory('smtp', array(
'host' => 'ssl://smtp.gmail.com',
'port' => '465',
'auth' => true,
'username' => 'myusername@gmail.com',
'password' => 'mypas',
'debug' => true
));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo('<p>' . $mail->getMessage() . '</p>');
} else {
echo('<p>Message successfully sent!</p>');
}
?>
屏幕打印出`发送成功的消息&#39;它还显示调试信息。不太确定我在调试信息中寻找的是什么,但我不相信有任何错误。在这里,以防万一它有助于解决这个问题。
DEBUG: Recv: 220 mx.google.com ESMTP 72sm4616111qgt.1 - gsmtp DEBUG: Send: EHLO localhost DEBUG: Recv: 250-mx.google.com at your service, [54.84.241.113] DEBUG: Recv: 250-SIZE 35882577 DEBUG: Recv: 250-8BITMIME DEBUG: Recv: 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN DEBUG: Recv: 250-ENHANCEDSTATUSCODES DEBUG: Recv: 250 CHUNKING DEBUG: Send: AUTH LOGIN DEBUG: Recv: 334 VXNlcm5hbWU6 DEBUG: Send: ZmFpcmNoaWxkd2Vic29sdXRpb25zQGdtYWlsLmNvbQ== DEBUG: Recv: 334 UGFzc3dvcmQ6 DEBUG: Send: WW9kYTEyM3lvZGE= DEBUG: Recv: 235 2.7.0 Accepted DEBUG: Send: MAIL FROM: DEBUG: Recv: 250 2.1.0 OK 72sm4616111qgt.1 - gsmtp DEBUG: Send: RCPT TO: DEBUG: Recv: 250 2.1.5 OK 72sm4616111qgt.1 - gsmtp DEBUG: Send: DATA DEBUG: Recv: 354 Go ahead 72sm4616111qgt.1 - gsmtp DEBUG: Send: From: To: Subject: Hi! Hi, How are you? DEBUG: Send: . DEBUG: Recv: 250 2.0.0 OK 1403297270 72sm4616111qgt.1 - gsmtp DEBUG: Send: QUIT DEBUG: Recv: 221 2.0.0 closing connection 72sm4616111qgt.1 - gsmtp