Problem with php form-to-mail script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
9greej10
Forum Newbie
Posts: 1
Joined: Thu Oct 22, 2009 3:19 am

Problem with php form-to-mail script

Post by 9greej10 »

Hi There

I have a bit of a strange problem with my php form-to-mail code. When submitted the code below does send an email to my address info@mydomain.com, however it doesn’t send to any of the email addresses on my client’s domain i.e. info@clientsdomain.co.uk This poses a problem as the website sits on my clients hosting and at the moment they can’t receive emails from the form-to-mail. I told my client to take off any filters they may have on their mail system, which might prevent emails being delivered from a auto form mailer - but still the mails don’t arrive, however they do send to my email address everytime with no problems, which is not on their domain.

***** PLEASE USE THE CODE TAG WHEN POSTING SOURCE CODE *****

Code: Select all

       $name = $_POST["name"];
        $email = $_POST["email"];
        $contact = $_POST["contact"];
        $query = $_POST["query"];
        $hear_about_us = $_POST["hear_about_us"];
        $to = "info@clientsdomain.co.uk";
        $user_list = array("info@clientsdomain.co.uk","info@mydomain.com");
        $list = implode(",", $user_list);
        $subject = "Enquiry submitted via website";
        $message = "An enquiry has been submitted via the website.\n
        Here are the details:\n
        Name: $name\n
        Email Address: $email\n
        Tel Number: $contact\n
        Query : $query \n
        How did you hear about us: $hear_about_us";
        $headers = "From: WebEnquiry@clientsdomain.co.uk\r\n" .
        "Reply-To: info@clientsdomain.co.uk \r\n" .
        "Bcc: $list\r\n";
        "X-Mailer: PHP/" . phpversion();
        mail($to, $subject, $message, $headers);
 
Can anyone think of a reason why this might be the case? Does anyone have a form to mail example that has worked every time for them on different hostings? Anything noticeably wrong with my code above?

Many thanks in advance
Post Reply