我现在面临的问题真的很奇怪。 我之前使用过下面给出的脚本,它的功能就像一个魅力,但现在它根本就没用了。
以下是代码:
function send($str){
$from = "body<body@gmail.com>";
$to = "TargetName <matthew.s@gmail.com>";
$subject = "Questionnaire Submission!";
$body = $str;
$host = "smtp.gmail.com";
$username = "body";
$password = "pwd";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("An error occured during submission! Please try again!");
} else {
echo("Submission Successful!!\nYou will now be redirected to a page to fix the timings.");
}
}
现在这段代码不会发送邮件,我无法理解为什么。
一些帮助将不胜感激。
最诚挚的问候 Priyabrata
修改的
我收到了用于发送邮件的帐户的邮件:
This is an automatically generated Delivery Status Notification
THIS IS A WARNING MESSAGE ONLY.
YOU DO NOT NEED TO RESEND YOUR MESSAGE.
Delivery to the following recipient has been delayed:
Message will be retried for 2 more day(s)
Technical details of temporary failure:
Message temporarily rejected. See http://support.google.com/mail/bin/answer.py?answer=69585 for more information.
答案 0 :(得分:0)
这与PEAR邮件无关;这是一般的电子邮件问题。 PEAR的Mail包可以很好地发送邮件 - 最近的PHP版本如5.5和5.6beta1。
尝试将邮件发送到其他电子邮件地址,这可能会有效。
另请遵循回复中support URL中所述的Gmail指南。
如果收件人是Gmail用户,我们将包含:
...
因此,请将邮件发送到Gmail地址,您将获得更多信息。