从PHP发送的邮件与PHPMailer id一起发送GMail垃圾邮件,无论如何

时间:2017-07-09 07:45:55

标签: php email gmail phpmailer incoming-mail

我已经在PHP中设置了一个使用PHPMailer发送电子邮件的脚本。 使用以下内容: - 使用TLS通过我自己的域SMTP服务器发送; - 使用DKIM / SPF签署/验证消息; - “发件人”电子邮件地址位于我发送的域名,以及“回复”

很遗憾,Gmail会自动将该电子邮件标记为垃圾邮件。 我的域名未列入黑名单(由MXtoolbox.com报告),SpamAssasin的得分为1.49。

PHP代码如下:

<?php
require 'PHPMailerAutoload.php';
$adresaMail = "contact@hbooking.eu";
$mail = new PHPMailer();
$mail->Sender = $adresaMail;
$mail->From = $adresaMail;


$mail->FromName = "Hotel Booking";
$mail->AddReplyTo($adresaMail, "Hotel Booking"); //Reply-To Address
$mail->IsSMTP();

$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = $adresaMail;  // SMTP username
$mail->Password = "Tele7abc$"; // SMTP password

$mail->SMTPSecure = 'tls'; // use TLS authentication
// $mail->SMTPSecure = "ssl"; // turn on SSL use
$mail->Host = "localhost";
$mail->Port = 25;
// $mail->SMTPDebug  = 1; // Enables SMTP debug information (for testing, remove this line on production mode)
// 1 = errors and messages
// 2 = messages only

// $mail->ConfirmReadingTo  = $adresaMail;
$mail->IsHTML(true); //turn on to send html email

//add image - begin
//$mail->AddEmbeddedImage('test.jpg', 'logoimg', 'test.jpg');
//add image - end
$mail->Subject = "Hotel booking webpage";
// use this if you want to use image
// $mail->Body     =  "Acest email a fost trimis folosind phpmailer - <img src=\"cid:logoimg\" />";

$Body = "<!DOCTYPE html>
<html lang='en' style='width: 100%; margin: 0'>
<head>
    <meta charset='utf-8' />
    <title></title>
</head>
<body style='font-size: 1em; width: 100%; margin: 0; background-color: white; font-family: 'Candara', 'Droid Sans', 'Roboto', 'Verdana', sans-serif'>
    <table style='margin-top: 3%; width: 90%; max-width: 800px; margin-right: auto; margin-left: auto; border: 1px solid #c0c0c0; padding: 1rem; border-collapse: collapse'>
        <tbody>
            <tr>
                <td style='background-color: #4169e1; font-size: 1.6rem; font-weight: 600; color: white; width: 10%; max-width: 80px; padding: 1rem'><span style='color: #ffda47'>H</span>B</td>
                <td style='background-color: #4169e1; font-size: 1.6rem; font-weight: 600; color: white; padding: 1rem; text-align: right'><span style='color: #ffda47'>H</span>Booking.eu</td>
            </tr>
            <tr>
                <td colspan='2' style='padding: 1rem; background-color: #f7f7f7'><p style='font-size: 1.25rem; font-weight: 600'>Signup confirmation</p>
                <p>Thank you for choosing to be a <strong>HBooking.eu</strong> member!</p>
                <p>Your subscription to our services has been confirmed.<br>
                You can now log-in and <strong>start advertising your hotel nights</strong> to all our travel agents and tour operator members across Europe.</p>
                <p>Please feel free to contact us for any queries you may have.</p>
                <p>Yours truly,<br>The <strong>HBooking.eu</strong> team

                </td>
            </tr>
            <tr><td colspan='2' style='background-color: #4169e1; color: white; text-align: center; padding: 1rem'>&copy; HBooking.eu , 2017. This email has been sent automatically; please do not reply to it.</td></tr>
        </tbody>
    </table>


</body>
</html>";



$mail->Body = $Body;

$mail->AddAddress("bogpop68@gmail.com","Bogdan Popescu");

if($mail->Send()){
$mail->ClearAddresses();
echo "message sent";
}
else {echo "did not send";}
?>

请帮忙。 提前谢谢大家。

0 个答案:

没有答案
相关问题