#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0

    Form to email script works on only some computers


    This is completely baffling me. I have a very simple form to email script, and when I access it and submit the form from my PC it goes just fine. If a friend goes to the web site from hers, it never comes through. The code is below.

    if(isset($_POST['submit']))
    {
    $fname = $_POST['firstName'];
    $lname = $_POST['lastName'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $phone = $_POST['phone'];
    $company = $_POST['company'];
    $message = $_POST['message'];

    $from_add = $_POST['email'];

    $to_add = "request@riopizzargv.com";
    $email_message .= "First Name: ".$fname."\n";
    $email_message .= "Last Name: ".$lname."\n";
    $email_message .= "Phone: ".$phone."\n";
    $email_message .= "Address: ".$adress."\n";
    $email_message .= "City: ".$city."\n";
    $email_message .= "State: ".$state."\n";
    $email_message .= "Zip: ".$zip."\n";
    $email_message .= "Company: ".$company."\n";
    $email_message .= "Special Instructions: ".$message."\n";
    $subject = "Rio Pizza Contact";


    $headers = "From: $from_add \r\n";
    $headers .= "Reply-To: $from_add \r\n";
    $headers .= "Return-Path: $from_add\r\n";
    $headers .= "X-Mailer: PHP \r\n";


    if(mail($to_add,$subject,$email_message,$headers))
    {
    $msg = "Thank You We Will Contact You Shortly";
    }
    else
    {
    $msg = "Error";
    }
    }

    echo $msg;
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    Try hard coding the from address, some mail servers will block outgoing mail for from addresses that they don't like.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0

    Still not working


    Originally Posted by E-Oreo
    Try hard coding the from address, some mail servers will block outgoing mail for from addresses that they don't like.
    The problem is this is a contact form the viewer is filling out, so I don't know the right address to hard code. Also when I sit at my computer at home and fill out the form it goes great. When I have a friend do the same it never arrives. Despite where it is coming from, it goes through the same mail server. I have switched the to email from the web site's server to gmail with the same results.
  6. #4
  7. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    What I mean is that the from address should not be set by the person filling out the form, it should always be the same for everyone. The reply-to address can be different, that's its purpose. Set the from address to one that you know works.

    The mail is probably being discarded by the outbound email server, so changing the to address won't affect the behavior.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo