I'm currently working on a web portfolio site for one of my web design courses, and it will hopefully become my actual portfolio when finished. Part of the assignment requires a "contact me" section for the site, which would include a form that validates input data and redirects the user on a proper submission. I have this finished, but I want it to actually email me when some submits the form. Here is my code:
$admin_mail = example@mail.com
-code to validate form-
$headers = array("First Name: " => $_POST['first_name'],
"Last Name: " => $_POST['last_name'],
"Email: " => $_POST['email'],
"Company: " => $_POST['company']);
$message = wordwrap($_POST['message'],70);
mail($admin_mail,"Portfolio Message",$message,$headers);
header("location: success.html");
I checked both the $headers
and $message
variables with the print_r
function, and they're working properly. All of the entered data is being added and the page redirects correctly, but the email doesn't appear to send at all. I checked that my webhost can send and receive emails, and that appears to work correctly as well.
Any ideas on how to fix this?