一尘不染

每当我的邮件进入phpmailer中的垃圾邮件时

php

这是我发送邮件的代码:

    $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();

每次我发送邮件时,它都会进入垃圾邮件。有人知道为什么会这样吗?


阅读 248

收藏
2020-05-29

共1个答案

一尘不染

根据您的代码,我注意到您是直接从您所在域的网页发送电子邮件。

例如,您使用了@ hotmail.com地址。

当收件人收到电子邮件时,收件人的邮件服务可能会测试邮件发件人的反向DNS。因此,发件人来自,@hotmail.com但邮件来自您的域,当然这不是
**hotmail.com** 。

因此,我从某个地址收到了一封邮件,@hotmail.com但IP发件人与域 **hotmail.com** 完全无关:这是垃圾邮件!

http://en.wikipedia.org/wiki/Reverse_DNS_lookup

我认为可能的解决方案是:在您的PHP代码中使用SMTP进行身份验证,然后从那里发送邮件!

2020-05-29