Okay I’m working in jQuery mobile, and I just put in a PHP script for the email form. Everything works great, except nothing is being sent to my inbox. Here is the form and php code, could really use some help here. Been scratching my brain for the longest.
<?php
if($_SERVER['REQUEST_METHOD'] == "POST")
{
$message_body = 'First Name: ' . $_POST['firstName'] . '
Last Name: ' . $_POST['lastName'] . '
Email: ' . $_POST['email'] . '
Company: ' . $_POST['company'] . '
Phone: ' . $_POST['phone'] . '
Services: ' . $_POST['serviceAreas'] .'
Message: ' . $_POST['comments'];
$to = 'marvin.fai2@gmail.com';
$subject = 'MobilizeWorldwide.com Contact Submission';
$message = $message_body;
$headers = 'From: info@mobilizeworldwide.com' . "\r\n" .
'Reply-To: ' . $_POST['email'] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
header('Location: ' . $_POST['thankspage']);
}
else
{
echo 'There is no post information.';
}
HTML:
<form method="post" action="email.php">
<input type="text" name="firstName" placeholder="First name" required>
<input type="text" name="lastName" placeholder="Last name" required>
<input type="text" name="email" placeholder="Email Address" required>
<input type="text" name="company" placeholder="Company">
<input type="text" name="phone" placeholder="Phone Number">
<fieldset>
<legend>Please indicate service areas of interest, and select all that apply:</legend>
<input id="airFrame" name="serviceArea" type="checkbox">
<label for="airFrame">VISA</label>
<input id="compMaint" name="serviceArea" type="checkbox">
<label for="compMaint">AmEx</label>
<input id="engineAPU" name="serviceArea" type="checkbox">
<label for="engineAPU">Mastercard</label>
<input id="engineAPULeas" name="serviceArea" type="checkbox">
<label for="engineAPULeas">VISA</label>
<input id="lMaint" name="serviceArea" type="checkbox">
<label for="lMaint">AmEx</label>
<input id="gTS" name="serviceArea" type="checkbox">
<label for="gTS">Mastercard</label>
<input id="onW" name="serviceArea" type="checkbox">
<label for="onW">VISA</label>
<input id="train" name="serviceArea" type="checkbox">
<label for="train">AmEx</label>
</fieldset>
<textarea id="comments" name="comments" placeholder="Comments" rows="8"></textarea>
<button type="submit" value="Submit" name="submit">
</form>
i didn’t consider your html form as i believe your post method working fine and email.php getting all values as you set, here in my case i am assuming dummy values for checking you script,
if(mail($to, $subject, $message, $headers))
echo “msg sent”;
else
echo ‘There is no post information.’;
?>
as i mentioned it before that i got the results but as spam for gmail, and working fine for other mailing servers;