php mail() 函数获取垃圾邮件
我在本地 WAMP 或服务器上发送的所有电子邮件,使用 PHP mail() 函数,总是会进入垃圾邮件文件夹。
在寻找问题时,我发现我们必须设置标头,例如来自 id、回复、返回路径、mime 版本、字符类型和字符集。我已经设置了所有这些,但电子邮件仍然会进入我的 Gmail 的垃圾邮件文件夹/ 雅虎 ID,有什么线索吗?
我在真实存在的发件人/收件人/回复/返回路径中使用的所有电子邮件地址仍然会进入垃圾邮件,非常奇怪!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试不包括“发件人:”,这可能会让服务器认为您正在欺骗。
try not including the "From: " this which might let the server think that you're spoofing.
我遇到了同样的问题,但没有任何效果。
我发现消息中的每一行都不允许超过 70 个字符。
解决方案是在消息后面添加自动换行。
$message= wordwrap($message, 70, "\r\n");
I had the same problem and nothing worked.
I found out, that no line in the message is allowed to have more than 70 characters.
Solution is to add wordwrap after the message.
$message= wordwrap($message, 70, "\r\n");
我在本地发现 sendmail_from 没有设置到我的 WAMP 中,一旦我使用,
ini_set('sendmail_from', 'some_valid_email_address');它到达收件箱!
哇哈哈...并且也投入到现场工作中..
What i've found locally that sendmail_from was not set into my WAMP, and once i used,
ini_set('sendmail_from', 'some_valid_email_address'); it gets to Inbox !
Wohaaa... and working into live as well..
仔细查看被标记为可能垃圾邮件的邮件中的 SMTP 标头。许多垃圾邮件过滤器会添加几行,列出邮件被标记的原因;例如,如果发送 IP 地址由于某种原因被列入黑名单,则可能有一个标头描述您被列入哪些黑名单。
Take a close look at the SMTP headers from the messages that are getting flagged as possible spam. Many spam filters will add a few lines listing the reasons a message was flagged; for example, if the sending IP address is blacklisted for some reason, there might be a header describing which blacklists you're listed in.
那是 邮件功能的>一个问题。更好的解决方案是选择以下任意一个:
That is one of the issues with
mail
function. The better solution is to go for either of these:要做的一件事是确保您的 HTML 有效。事实证明,垃圾邮件发送者通常无法编写验证 HTML,因此这是一个巨大的提示。
另一种可能性是您与垃圾邮件发送者的另一个用户位于共享主机上。在这种情况下,整个 IP 范围可能已被禁止。
此外,在 CSS 中使用红色和垃圾邮件词(例如“免费”、“伟哥”、“立即行动”、“促销”等)是某些垃圾邮件过滤器使用的提示。
要使您的电子邮件远离垃圾邮件文件夹,您可以做的最重要的事情就是仅向请求的人发送电子邮件。这将防止人们将您举报为垃圾邮件。如果您的大量电子邮件被报告为垃圾邮件,那么您的电子邮件将被放入垃圾邮件文件夹。
One thing to do is to make sure that your HTML validates. It turns out that spammers are generally incapable of writing validating HTML and so this a huge tip off.
Another possibility is that you're on a shared host with another user that's a spammer. In this case, the whole IP range may have been banned.
Also, using red in your CSS and spammy words (think "free", "viagra", "act now", "sale", etc) are tip offs that some spam filters use.
The biggest thing that you can do to keep your emails out of spam folders is to only send emails to people that request them. This will keep people from reporting you as spam. If a lot of your emails get reported as spam, then your emails will get put in spam folders.