Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
347 views
in Technique[技术] by (71.8m points)

PHP Email wont send to custom email addresses

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 <[email protected]>
";
$mailheader.= "X-Sender: " . "[email protected]
";
$mailheader.= "Return-Path: " . "[email protected]
";
$mailheader .= "Bcc: [email protected]";

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

?>  
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...