webmachine
webmachine

Reputation: 71

Form doesn't send info to email address (works on others though)

My client has a Wordpress content management system to which I added a simple contact form with a php form handler. The contact form sends the information by email correctly to all three of my email addressses, but when I change to my client's email address the email never arrives. I have run out of ideas where I could look for the problem. No it does not go to his junk mail folder. :)

Upvotes: 0

Views: 168

Answers (2)

Giannis
Giannis

Reputation: 813

What is the mail function that you are using? Do you attach a header to it? It sounds like it is being marked as spam from the exchange server. What I use (and have always worked for me) is something like this: `

function mailme($sendto,$sendername,$from,$subject,$sendmailbody,$bcc="")
{
    $subject = nl2br($subject);
    $sendmailbody = nl2br($sendmailbody);
    if($bcc!="")
    {
        $headers = "Bcc: ".$bcc."\n";
    }
    $headers = "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html; charset=utf-8 \nContent-Transfer-Encoding: 8bit\n";
    $headers .= "X-Priority: 3\n";
    $headers .= "X-MSMail-Priority: Normal\n";
    $headers .= "X-Mailer: PHP/"."MIME-Version: 1.0\n";
    $headers .= "From: " . $from . "\n";
    $headers .= "Content-Type: text/html\n";
    mail("$sendto","$subject","$sendmailbody","$headers");
}

`

Upvotes: 1

FreudianSlip
FreudianSlip

Reputation: 2920

Sounds like the email is being routed "internally" through your clients network and not out onto the internet. The chances are they have some restrictions on what machines can be used to send emails internally, or the mail routing system sees the internal email as being "different" and does something odd with it.

Try using (from a cli) :

echo "Testing " | mailx -"Test Subject Line" [email protected]

Upvotes: 1

Related Questions