Using php to email from html form - email is sent but empty
Posted: Wed Jan 21, 2009 11:59 am
Hi - I am new here and to php. I am using it to send a very simple email from an html contact form. It is hosted on a web server that I have no access to and the hosting company doesn't seem to know what to configure or how. I've tested the code on 2 other Linux servers and it works perfectly - testing on the server it is supposed to be hosted on generates an empty email. Any thoughts as to why the email gets sent without errors, but is empty, but works fine as is on a different server? Below is the php code - all values are being passed properly. Any suggestions would be greatly appreciated. You'll have to be very specific as my knowledge of php is limited. Thanks so much. The problematic server is running php 5.0 but that is all the info I have.
?>
Code: Select all
<?php
$name = $first_name." ".$last_name;
$street = $address;
$address = $city.", ".$state." ".$zip_code;
$from = "mhaines@haineselectric.com";
$time = $when_to_call;
$comments = $additional_comments;
$subject = "Customer Service Request from Website";
$email = $email_address;
$pPhone = $day_phone_area."-".$day_phone_exchange."-".$day_phone_number;
$aPhone = $evening_phone_area."-".$evening_phone_exchange."-".$evening_phone_number;
$to = "service@haineselectric.com";
$contents = "Customer Service Request from Website: \n\n".$name."\n".$street."\n".$address."\n\n".$email."\n\nDay Phone: ".$pPhone."\nEvening Phone: ".$aPhone."\n\nBest Time to Call: ".$time."\nAdditional Comments: ".$comments;
mail($to, $subject, $contents);
header("Location: http://www.haineselectric.com/thankyou.html");