【发布时间】:2016-05-07 08:37:55
【问题描述】:
// Subject of your email
$subject = $_REQUEST['subject'] . ' - Personal website contact form submittion.';
// Recipient's E-mail
$to = 'recipient@domain.com';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Sender's E-mail
$headers .= "From: Contact Form (Domain.com) <no-reply@domain.com>";
$message .= 'Name: ' . $_REQUEST['name'] . "<br>";
$message .= 'Email: ' . $_REQUEST['email'] . "<br>";
$message .= 'Message: ' . $_REQUEST['message'] . "<br>";
if (@mail($to, $subject, $message, $headers)) {
// Transfer the value 'sent' to ajax function for showing success message.
echo 'sent';
} else {
// Transfer the value 'failed' to ajax function for showing error message.
echo 'failed';
}
如何在此处放置回复标题? 回复邮件应该是填写表格时输入的邮件,不知道PHP有没有人能帮帮我?谢谢
【问题讨论】:
-
与
$headers的其余部分完全一样...如果您正在使用 mime 等“复杂”消息,您应该使用适当的邮件包,如 phpmailer 或 swiftmailer . php 内置的mail()基本上就是个玩具。