I'm building a form that allows someone to sign up for a deal. I want the form to send 3 emails using php once it has been submitted; one sending the details of the form to myself, one sending the details to the person offering the deal, and one sending the actual deal confirmation and voucher to the person who signed up.
I've run into problems in that certain email addresses don't seem to receive or be sent the email when i'm testing it (it works for both my hotmail and gmail addresses, but not for my own domain email address). I also can't figure out how to add some sort of html style to the emails being sent.
How can I style these emails and make sure that they are being sent to right email addresses?
here is the code:
<?php
}
else /* send the submitted data */
{
$name=$_REQUEST['name'];
$airline=$_REQUEST['airline'];
$position=$_REQUEST['position'];
$checkin=$_REQUEST['checkin'];
$attendance=$_REQUEST['attendance'];
$email=$_REQUEST['email'];
$terms=$_REQUEST['terms'];
if (($name=="")||($position=="")||($checkin=="")||($attendance=="")||($email==""))
{
echo "All fields are required, please fill <a href=\"\">the form</a> again.";
}
//email going to me//
else{
$from="From: Deal 1 Form Submission<$email>
Return-path: $email";
$subject="Message sent using your contact form";
mail("myemail@test.com",
$subject,
$message="someones taken the deal: heres their info: <br> Name: $name
Airline: $airline
Position: $position
Checkin: $checkin
Attendance: $attendance
Email: $email
" );
echo "Email sent!";
}
//email going to the customer//
{
$from="From: me<myemail@test.com>
Return-path: $email";
$subject="Thank you for choosing this deal";
mail("$email", $subject, $message="thanks for choosing this deal!, please present this voucher when attending the restaurant", $from );
}
//email going to the partner//
{
$from="From: Me<myemail@test.com>
Return-path: $email";
$subject=" Great news! Someone has chosen your deal";
mail("partneremail@test.com",
$subject,
$message="Fantastic news, a customer has taken your deal! here's their info: Name: $name
Airline: $airline
Position: $position
Checkin: $checkin
Attendance: $attendance
Email: $email
", $from );
}
}
?>
Many thanks.