我的邮件作为垃圾邮件发送,我使用php mail() [英] My mails are sent as spam, i use php mail()
问题描述
我有一个网站,向注册者发送一封邮件,而绝对不是垃圾邮件。事实是,我在PHP中使用了mail()函数,但很多人将其作为垃圾邮件接收。
I have a website which send a single mail for those who register, definitely not spam. And the thing is that I use mail() function in PHP but lots of people receive it as spam.
$title = "title";
$body = "message";
$header = "MIME-Version: 1.0" . "\r\n";
$header .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$header .= "To: ".$_POST["name"]." <".$_POST["email"].">" . "\r\n";
$header .= "From: SteamBuy <contacto@steambuy.com.ar>" . "\r\n";
mail($_POST["email"], $title, $body, $header, "-f contacto@steambuy.com.ar");
所以我想知道我在做什么错,以及如何解决。我不希望我的邮件显示为垃圾邮件,因为其中有些邮件可能包含有价值的信息。
So I want to know what am I doing wrong, and how can I fix it. I don't want my mails to appear as spam as some of they may contain valuable information.
推荐答案
重要的部分不是 mail()
本身,而是您托管网站的主机。因为您的电子邮件包含主机的所有相关信息-IP,等等。
The important part is not mail()
per se, but the host you're hosting your site on. Because your email contains all relevant information of your host - IP, and so on.
由于大多数共享主机都使用一台主机,因此用户数量众多托管在单个服务器上,大多数/某些用户可能想使用 mail()
,因此电子邮件提供商可能会将主机的IP列入黑名单。这意味着您的网站已包含在该黑名单中。
Since most shared hosts, I assume you're using one, have a ton of users hosted on a single server, and most/some may want to use mail()
, email providers may blacklist the IP of the host. Which means your site is included in that blacklist.
使用共享主机时无法解决此问题。
There is no way around this issue when using a shared host.
这篇关于我的邮件作为垃圾邮件发送,我使用php mail()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!