September 30th, 2012, 03:19 AM
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.
$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 = "email@example.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";
$msg = "Thank You We Will Contact You Shortly";
$msg = "Error";
September 30th, 2012, 09:18 AM
Try hard coding the from address, some mail servers will block outgoing mail for from addresses that they don't like.
September 30th, 2012, 11:18 AM
Still not working
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.
Originally Posted by E-Oreo
September 30th, 2012, 12:10 PM
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.