Gmail会将邮件标记为来自我网站的垃圾邮件

时间:2013-11-09 00:03:11

标签: php email gmail

我使用php

向新用户发送验证邮件
$subject = "Account Verification";
$message = '
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    </head>
        <body style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;">
            <div>
            <p>Hello '.$username.'!</p>
            <p>You just registered on <span style="font-weight: bold;">site.com</span>.<br />To activate your registration please click on this link. If you can’t click the link, copy and paste it into your browser:<br /><span><a href="http://site.com/validate.php?e=user@email.com&k=56as1d9a1sda9s1d9a1sd9">http://site.com/validate.php?e=user@email.com&k=56as1d9a1sda9s1d9a1sd9</a></span></p>
            <p>If you did not register on Site.com and have received this email in error, please ignore it.</p>
            <p>Thank you!</p>
        </div>
    </body>
</html>';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: My Web Site <webmaster@site.com>' . "\r\n";
$headers .= 'Return-Path: webmaster@site.com\r\n';
// Mail it
mail($mail, $subject, $message, $headers);

此电子邮件包含验证链接,所有邮件都将Google标记为垃圾邮件..

但是,如果我从邮件中删除链接并测试它,所有邮件都会在收件箱中定期收到.. 我在这里做错了,为什么带链接的邮件被标记为垃圾邮件?

1 个答案:

答案 0 :(得分:-1)

大多数mail()函数最终都是gmail中的垃圾邮件。要绕过它,您可以在主题或内容中添加用户的名称。一旦你这样做,邮件就会收到Inbox中的通知标签,因为它被认为对用户很重要。我已经在000webhost上试过了,即使使用HTML电子邮件它也能正常工作。