是的,我已经在这里阅读了关于“我的php没有发送电子邮件”的所有内容,这对我的问题没有帮助。
我查看并查看了这个PHP脚本,我终于把它发送到“发送邮件”并将其发送到我的thank-you.html。但是,我从未收到过电子邮件。有人可以帮忙吗? :/
<?php
print_r($_POST);
//die;
$field_name = $_POST['name'];
$field_email = $_POST['email'];
$field_message = $_POST['message'];
$field_option = $_POST['option'];
$field_number = $_POST['number'];
$field_choice = $_POST['choice'];
$mail_to = 'tbcoh5091@gmail.com';
$subject = 'A prayer form has been submitted by '.$field_name;
$body_message .= 'Option: '.$field_option."\n";
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Number: '.$field_number."\n";
$body_message .= 'Message: '.$field_message."\n";
$body_message .= 'Choice: '.$field_choice;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail('tbcoh5091@gmail.com', $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
window.location = 'thank-you.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, go back and try again.');
window.location = 'prayer-and-praise.html';
</script>
<?php
}
?>
请尽可能帮助我!谢谢。如果我需要发布我的表单的HTML部分,就是这样。
<form action="email.php" method="POST">
<input type="hidden" name="recipient" value="tbcoh5091@gmail.com" / >
<input type="hidden" name="subject" value="From the Prayer form" / >
<p>Is this going to be a Prayer, Praise, or both?</p>
<input type="radio" name="option" value="Prayer"> Prayer
<input type="radio" name="option" value="Praise"> Praise
<input type="radio" name="option" value="Both"> Both
<p> </p>
<p>First and Last Name</p>
<input type="text" name="name" size="60">
<p> </p>
<p>Email Address</p>
<input type="text" name="email" size="60">
<p> </p>
<p>Phone Number (optional)</p>
<input type="text" name="number" size="10">
<p> </p>
<p>Your Message</p>
<textarea name="message" rows="9" cols="60"></textarea>
<p> </p>
<p>Last but not least, please indicate if you would like for this to stay personal, or sent out to congregation.</p>
<input type="radio" name="choice" value="personal"> Personal
<input type="radio" name="choice" value="sent_out"> Send to Congregation
<p> </p>
<input type="submit" value="Submit"> <input type="reset" value="Reset">
</form>