[英]Getting warning message in Gmail Account when I send email by using phpmailer()
I am using phpmailer() to send email from my website. 我正在使用phpmailer()从我的网站发送电子邮件。 But when It's sent email I see following warning message.
但是,当它发送电子邮件时,我看到以下警告消息。
I can't understand why it's showing and how can I fix this error message. 我不明白为什么会显示该消息以及如何解决此错误消息。 Can anyone tell me about it ?
有人可以告诉我吗?
Following is my code : 以下是我的代码:
<?php
require_once("mail/PHPMailerAutoload.php");
$mail = new PHPMailer;
$mail->setFrom($email);
$mail->addReplyTo('toemail@gmail.com', 'First Last');
$mail->addAddress('toemail@gmail.com', 'First Last');
$mail->Subject = 'PHPMailer mail() test';
$mail->msgHTML(file_get_contents('mail/contents.html'), dirname(__FILE__));
$mail->AltBody = 'This is a plain-text message body';
$mail->addAttachment('mail/images/phpmailer_mini.png');
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
Easy, you could read about SPF DNS Record. 容易,您可以阅读有关SPF DNS记录的信息。
When you send and email, services like gmail check if the sender ip is the same that the domain of the email, for example: 当您发送电子邮件时,类似gmail的服务会检查发件人ip是否与电子邮件域相同,例如:
You send an email as "foo@gmail.com" to "bar@hotmail.com". 您将电子邮件作为“ foo@gmail.com”发送到“ bar@hotmail.com”。 Your server ip is 1.1.1.1
您的服务器IP为1.1.1.1
Hotmail receives an email from "foo@gmail.com" so check if gmail.com ip (2.2.2.2) is the same as your server (1.1.1.1). Hotmail收到来自“ foo@gmail.com”的电子邮件,因此请检查gmail.com ip(2.2.2.2)是否与您的服务器(1.1.1.1)相同。 The answer is NO, so the email is marked as spam.
答案是否定的,因此该电子邮件被标记为垃圾邮件。
To avoid that your email will marked as spam, you could use phpmailer using a real google account and provide phpmailer the user and password to send the email. 为了避免您的电子邮件被标记为垃圾邮件,您可以使用具有实际Google帐户的phpmailer并向phpmailer提供用户名和密码来发送电子邮件。
I tried to explain you the situation very easy on point 2. Real situation is a bit complicated but the logic is the same, check ip sender and origin. 我试图在第二点很容易地向您解释这种情况。实际情况有些复杂,但逻辑是相同的,请检查ip发送方和来源。 Read about SPF (and dkim) because is what are you looking for :) http://en.wikipedia.org/wiki/Sender_Policy_Framework
阅读有关SPF(和dkim)的信息,因为您要寻找的是:) http://en.wikipedia.org/wiki/Sender_Policy_Framework
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.