好的,我正在使用 jQuery mobile,我只是为电子邮件表单输入了一个 PHP 脚本。一切都很好,除了没有任何东西发送到我的收件箱。这是表单和php代码,真的可以在这里使用一些帮助。一直在挠我的大脑最长时间。
<?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>