每次我的邮件在 phpmailer 中变成垃圾邮件 [英] Everytime my mail goes to spam in phpmailer
问题描述
这是我发送邮件的代码:
Here are my codes for sending mail:
$fullname = $_POST['fullname'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$date = $_POST['date'];
$time = $_POST['time'];
$adult = $_POST['adult'];
$children = $_POST['children'];
$company_name = $_POST['company_name'];
$addition = $_POST['addition'];
$confirm = $_POST['confirm'];
$body = '
<table width="100%" border="0" cellpadding="0">
<tr>
<td>Dear Sir,
</td>
</tr>
<tr>
<td><b>Booking request from '.$fullname .'</b><br /><br />
<u>The details provided are:</u><br />
<p>Name : '.$fullname.'<br />
E-mail Address: '.$email.'<br />
Telephone: '.$telephone.'<br />
Date: '.$date.'<br />
Time: '.$time.'<br />
Adult: '.$adult.'<br />
Children: '.$children.'<br />
Company Name: '.$company_name.'<br />
Confirm by: '.$confirm .'<br />
Additional Requirements: '.$addition.'<br />
</p>
</td>
</tr>
<tr>
<td>
<p>Thank you,<br />
Kaavya Cuisine
</p></td>
</tr>
</table>
';
$to = 'sujal@longtail.info';
$subject = 'Booking Request';
$sitename='Website Name';
$mail = new PHPMailer();
$mail->AddReplyTo($to,$sitename);
$mail->SetFrom($email,$fullname);
$mail->AddAddress($to, $sitename);
$mail->Subject = $subject;
$mail->MsgHTML($body);
$mail->Send();
每次我发送邮件时,它都会变成垃圾邮件.有谁知道为什么会这样?
Every time I send the mail, it goes in to spam. Does anyone know why this is happening?
推荐答案
根据您的代码,我注意到您直接从您域中的网页发送电子邮件.
Based on you code i notice that you are sending an email directly from you web page on your domain.
例如,您使用了 @hotmail.com 地址.
For example you used an @hotmail.com address.
当收件人收到电子邮件时,收件人的邮件服务可能会测试邮件发件人的反向 DNS.所以发件人来自 @hotmail.com
,但邮件来自您的域,当然不是 hotmail.com.
When the recipient receive the emails the mail service of the recipient may test a reverse DNS of the sender of the mail. So the sender is from @hotmail.com
but the mail comes from your domain which of course is not hotmail.com.
所以我收到一封来自地址 @hotmail.com
的邮件,但 IP 发件人与域 hotmail.com 根本没有关系:那是垃圾邮件!
So I receive a mail from an address @hotmail.com
but the IP sender isn't related at all with domain hotmail.com: that's SPAM!
http://en.wikipedia.org/wiki/Reverse_DNS_lookup
我认为一个可能的解决方案是:在您的 PHP 代码中使用 SMTP 身份验证并从那里发送邮件!
I think a possible solution is: in you PHP code use authenticate with SMTP and from there send the mail!
这篇关于每次我的邮件在 phpmailer 中变成垃圾邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!