0

我有一个简单的模板,我一直用它来使用 php 向我的网站用户发送电子邮件。

我现在注意到,由于某种奇怪的原因,gmail 似乎认为我的电子邮件是垃圾邮件,因此我网站上发送到 gmail 地址的每封邮件最终都会进入垃圾邮件文件夹。

由于该域是一个新域,我怀疑其原因是因为我的网站被标记为以某种方式分发垃圾邮件的网站,所以我得出的结论是它必须取决于我的 html 用户以及可能的方式我使用了超链接。

如果有人可以查看我在下面放置的简短示例并向我解释我在这一切中做错了什么,我将不胜感激,因为我已经摸索了很长时间,这似乎是有效的根据规范?

欢迎任何意见、建议、反馈或想法,谢谢!

<?php
// multiple recipients
$to  = "exampleuser@gmail.com";

// subject
$subject = 'Please Confirm User Account Registration';

// message
$message = '
<html>
<head>
    <title>My Domain User Account Registration</title>
</head>
<body>
    <p>My Domain User Account Registration :</p>
    <p>We have just received a request to have your information added to our website as a user account. This would enable you to buy products on our website at <a href="http://www.mydomain.com/">http://www.mydomain.com/</a></p>
    <p>If this is correct and you do wish to create a new user account on our website, please click the link below to be directed our website.</p>
    <p><a href="http://www.mydomain.com/users/register/confirmation/confirm.php?confirm=12345&key=12345abcde">http://www.mydomain.com/users/register/confirmation/confirm.php?confirm='.$userId.'&key='.$randomKey.'</a></p>
    <p>If you received this email by mistake, simply delete it. You won&rsquo;t be subscribed if you don&rsquo;t click the confirmation link above and your email address will be removed from our database by tomorrow.</p>
    <p>For questions about this message, please contact us at : <a href="mailto: info@mydomain.com">info@mydomain.com</a></p>
    <p>Thank you.</p>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'From: Accounts @ www.mydomain.com <accounts@mydomain.com>' . "\r\n";

//Send the message
mail($to, $subject, $message, $headers);
?>
4

2 回答 2

1

如果可以的话,把这个拿出来:

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

然后,您以纯文本形式发送电子邮件,它们不会被自动检测为垃圾邮件。

于 2013-01-18T12:22:07.857 回答
0

在纠缠我的主机相当长一段时间后,发现他们的服务器基本上被标记为垃圾邮件的发件人,所以来自我网站上的有问题的共享服务器上的邮件会自动发送到垃圾邮件文件夹以供 gmail用户...

需要注意的事情!

于 2013-05-21T23:43:31.837 回答