简体   繁体   English

邮件已发送但未通过PHPMailer中的电子邮件地址接收?

[英]Message sent but doesnt receive by email address in PHPMailer?

Im using PHPmailer 5.4.2 and try one of its given example. 我正在使用PHPmailer 5.4.2并尝试其给定的示例之一。 It gives me true result which is "Message Sent" but the email address I have states in the code doesnt receive anything. 它给我真实的结果是“已发送消息”,但是我在代码中注明的电子邮件地址未收到任何信息。 Here is the code. 这是代码。

<html>
<head>
<title>PHPMailer - Mail() basic test</title>
</head>
<body>

<?php

require_once('../class.phpmailer.php');

$mail             = new PHPMailer(); // defaults to using php "mail()"

$body             = "fhgdshfgjsd";

$mail->SetFrom('verbz95@gmail.com', 'Verbo Angelo Ludovice');

$mail->AddReplyTo("verbz95@gmail.com","Verbo Angelo Ludovice");

$address = "espadadave@yahoo.com";
$mail->AddAddress($address, "John Doe");

$mail->Subject    = "PHPMailer Test Subject via mail(), basic";

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

$mail->MsgHTML($body);

$mail->AddAttachment("images/phpmailer.gif");      // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

?>

</body>
</html>

That's because you are trying to send email from your server via gmail without any authentification, therefore yahoo treats it as a forged/spam email. 那是因为您尝试通过gmail从服务器发送电子邮件,而没有任何身份验证,因此yahoo将其视为伪造/垃圾邮件。 You will need to either: 您将需要:
- don't use **@gmail.com as a from address -不要使用**@gmail.com作为发件人地址
- or forward your mail thru gmail smtp server (you will need to provide credentials), you can find all settings in your gmail\\settings\\pop3, imap tab -或通过gmail smtp服务器转发邮件(您将需要提供凭据),则可以在gmail \\ settings \\ pop3,imap标签中找到所有设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM