开发者

Form doesn't send email to some addresses

开发者 https://www.devze.com 2023-02-27 19:58 出处:网络
I\'m having a problem with my simple form script which always send to my previous email address, now doesn\'t send to my new one. Is it because there\'s a dash in the address? Here\'s the script:

I'm having a problem with my simple form script which always send to my previous email address, now doesn't send to my new one. Is it because there's a dash in the address? Here's the script:

<?php 

if ($_POST["email"] <> '') {
    $ToEmail = 'info@xxx-xxx.com';
    $EmailSubject = 'Site contact form '; 
    $mailheader = "From: ".$_POST["email"]."\r\n"; 
    $mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; 
    $mailheader .= "Content-type: text/html; charset=utf-8\r\n"; 
    $MESSAGE_BODY = "Name: ".$_POST["name"]."<br>"; 
    $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>"; 
    $MESSAGE_BODY .= "Telephone: ".$_POST["tel"]."<br>";
    $MESSAGE_BODY .= "Type: ".$_POST["type"]."<br>";
    $MESSAGE_BODY .= "Subject: ".$_POST["subject"]."<br>";
    $MESSAGE_BODY .= "Hours per week: ".$_POST["hours"]."<br>";
    $MESSAGE_BODY .= "Additional information: ".nl2br($_POST["info"])."<br>"; 

    // HAS THE SPAM TRAP FIELD BEEN FILLED IN?

    if( !empty( $_POST['random'] ) )
    {exit;}

    mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); 

?> 

<html>

    <h3>Thank you for your e开发者_如何学Gomail</h3>
    <h4>I'll get back to you as soon as possible</h4>
    <a href="index.html"><p>Click here to go back to the home page</p></a>

</html>


<?php 
} else { 
?> 

<html>Sorry, this form didn't work</html>

Any help would be appreciated. Thanks


It is probably getting caught in a spam filter on the receiving end. Add the sender email address in your script to your new email's white list and see if that helps.


Did you migrate from a Gmail to a Yahoo account? The dash should not make any difference. Certain email providers (esp. Yahoo) have problems with emails being sent using the mail command.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号