douliao8402 2014-07-15 20:21
浏览 60
已采纳

PHP电子邮件不会发送到自定义电子邮件地址

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>
";
$mailheader.= "X-Sender: " . "support@smartphonepettag.com
";
$mailheader.= "Return-Path: " . "support@smartphonepettag.com
";
$mailheader .= "Bcc: support@smartphonepettag.com";

$body .= "Dear " . $ownername . ", 

";

$body .= "" . $petname . "'s Smartphone Pet Tag has just been scanned.

";
$body .= "Click here to Login :
";
$body .= "http://www.smartphonepettag.com
";
$body .= "********************

";
// $body .= "Scan detected at " . $
//$body .= "Your pets id tag was scanned at the following date and time: " . $datetime; . ", 
";
// $body .= "To stop receive automated alerts click here: 
";
// $body .= 'http://www.smartphonepettag.com/id/alert.php';
// $body .= "and provide your username and password to remove these alerts.
$body .= "Regards,";
$body .= " 

";
$body .= "Smartphone Pet Tag Team";
$body .= " 

";
$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");  

?>  
  • 写回答

1条回答 默认 最新

  • dongmaxi6763 2014-07-15 20:35
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度