问题描述
我有一个脚本向客户发送一封电子邮件。我们刚刚注意到,电子邮件只会发送到通常结尾的电子邮件地址:@ gmail.com,@ yahoo.com,@ Hotmail.com等。每当我们遇到自定义的电子邮件地址(如 ** @platinumpets.com或 * @ landsberg.com不会收到电子邮件地址。我可以确认服务器正在发送电子邮件,用户从来没有收到。我们检查了所有的垃圾邮件文件夹,并完成了各种Google搜索,但我没有发现任何类似于我们的问题。有任何想法吗?以下是代码: <?PHP
$ subject =Alert
$ mailheader。=From:。 智能手机宠物标签小组< support@smartphonepettag.com> \\\
;
$ mailheader =X-Sender:。 support@smartphonepettag.com\\\
;
$ mailheader。=返回路径:。 support@smartphonepettag.com\\\
;
$ mailheader。=Bcc:support@smartphonepettag.com;
$ body。=亲爱的。 $ ownername。 ,\\\
\\\
;
$ body。=。 $ petname。 的智能手机宠物标签刚被扫描。
$ body。=点击这里登录:\\\
;
$ body。=http://www.smartphonepettag.com\\\
;
$ body。=******************** \\\
\\\
;
// $ body。=Scan detected at。 $
// $ body。=您的宠物ID标签在以下日期和时间被扫描:。 $日期时间; 。 ,\\\
;
// $ body。=停止接收自动提醒点击这里:\\\
;
// $ body。='http://www.smartphonepettag.com/id/alert.php';
// $ body。=并提供您的用户名和密码以删除这些警报
$ body。=Regards;
$ body。=\\\
\\\
;
$ body。=智能手机宠物标签团队;
$ body。=\\\
\\\
;
$ body。=保持宠物安全找到;
邮件($ email_to,$ subject,$ body,$ mailheader)或死(邮件无法发送);
//结束电子邮件警报
}
// $ id = $ _ GET [id] ;;
if(!$ id){
echo'您尚未输入ID号,请返回再试一次';
exit;
}
if($ id ==id = app){
header(Location:http:// www.smartphonepettag.com/id/app.php);
退出;
}
标题(位置:http://www.smartphonepettag.com/id/ profile.php?id = $ id);
?>
我不知道你从哪里得到& email_to
,但这似乎也不是问题。 p >
对我来说似乎这不是PHP的问题。 PHP内置邮件功能通常不使用白名单或任何类似的东西,在代码中我看不到与您所描述的任何问题。
但PHP使用您的服务器系统上安装的本地邮件服务器。那么也许这是在您的邮件服务器上配置奇怪的东西?您可以尝试通过SMTP直接发送邮件,以确定是否发送成功。根据您的邮件服务器,您还可以查看发件箱(如果您还没有)。
否则,接收器绝对是一个问题。 。如果您确信邮件已发送,但问题与垃圾邮件过滤器无关,您并不真的有机会做任何事情。在这种情况下,您不能更改外部邮件服务器的行为。
但对我来说似乎很可能是垃圾邮件问题。
I have a script to send a customer an email. We have just noticed that the emails are only being sent to email addresses that end normally like : @gmail.com, @yahoo.com, @Hotmail.com, etc. Whenever we encounter a custom email address like **@platinumpets.com or *@landsberg.com the email address will not ever be received. I can confirm that the server is sending out the email, the user is just never receiving it. We have checked all spam folders and done various Google searches but I have not found any issues this similar to ours. Any ideas? Here is the code :
<?PHP
$subject = "Alert";
$mailheader.= "From: " . "Smartphone Pet Tag Team <support@smartphonepettag.com>\n";
$mailheader.= "X-Sender: " . "support@smartphonepettag.com\n";
$mailheader.= "Return-Path: " . "support@smartphonepettag.com\n";
$mailheader .= "Bcc: support@smartphonepettag.com";
$body .= "Dear " . $ownername . ", \n\n";
$body .= "" . $petname . "'s Smartphone Pet Tag has just been scanned.\n\n";
$body .= "Click here to Login :\n";
$body .= "http://www.smartphonepettag.com\n";
$body .= "********************\n\n";
// $body .= "Scan detected at " . $
//$body .= "Your pets id tag was scanned at the following date and time: " . $datetime; . ", \n";
// $body .= "To stop receive automated alerts click here: \n";
// $body .= 'http://www.smartphonepettag.com/id/alert.php';
// $body .= "and provide your username and password to remove these alerts.
$body .= "Regards,";
$body .= " \n\n";
$body .= "Smartphone Pet Tag Team";
$body .= " \n\n";
$body .= "Keeping Pets Safe and Found";
mail($email_to, $subject, $body, $mailheader ) or die ("Mail could not be sent.");
//end email alert
}
//$id=$_GET["id"];;
if (!$id) {
echo 'You have not entered an ID number. Please go back and try again.';
exit;
}
if ($id=="id=app") {
header("Location: http://www.smartphonepettag.com/id/app.php");
exit;
}
header("Location: http://www.smartphonepettag.com/id/profile.php?id=$id");
?>
I'm not sure where you get &email_to
from but this doesn't seem to be the problem anyway.
For me it seems that this is not a problem with PHP. PHP built-in mail functions usually don't use whitelists or anything like this and in your code I can't see any problems relating to what you describe.
But PHP uses the local mailserver installed on your server system. So maybe it's something strange configured on your mail server? You may try sending mails directly via SMTP to find out if the will be sent successful. Depending on your mailserver you may also check the "outbox" (if you not already did).
Otherwise it is definitely a problem with the receiver. PHP generated eMails often look like spam for spam filters. If your are sure that the mail is sent but the problem is not related to the spam filter you don't really have a chance to do anything. You can't change the behaviour of foreign mail servers in this case.
But for me it seems very likely that it's a spam-problem.
这篇关于PHP电子邮件不会发送到自定义电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!