March 26th, 2013, 07:50 AM
PHP Email Form - Email not sending
I am new to PHP and I am trying to get PHP to send the contents of my form to my email address.
Unfortunatly, I do not receieve the email, I have done some research, and I feel it may be due to the fact I have not defiend the mail server? Again, I am very new to this and the forums which had similar posts to mine, I struggled to understand.
Here is my PHP code:
Please could you kindly advise on what additions or corrections I need to make in order to get the contents of the form to me sent to my email address.
/*Subject and Email Validation */
$emailSubject = 'Woodingdean Dry Cleaners Enquiry';
$webMaster = 'firstname.lastname@example.org';
/* Gathering Data Variables */
$titleField = $_POST['title'];
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$telephoneField = $_POST ['telephone'];
$messageField = $_POST ['message'];
$body = "
$headers = "From: $emailField\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail("email@example.com", $emailSubject, $body, $headers);
/* Results rendered as HTML */
$theResults = "
<title>Woodingdean Dry Cleaners</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
font-family: Verdana, Arial, Helvetica, sans-serif;
<div align=\"left\">Your enquiry has been recieved. We will get back to you as soon as we can.</div>
Thanks in advance,
March 26th, 2013, 08:01 AM
First use <?php instead of <?PHP , use phpmailer, eat your vegetable.
Originally Posted by NavrajPanesar
March 26th, 2013, 08:05 AM
PHP mail depends on 'sendmail'. Do you even have a mail server installed? If not you probably need to use PHPMailer which allows for an external mail server.
There are 10 kinds of people in the world. Those that understand binary and those that don't.