Reply-to header 联系表 PHP
Reply-to header in contact form PHP
// 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';
}
如何把reply-to header放在这里?
Reply-to email 应该是填表时填写的email,不知道PHP 谁能帮帮我?谢谢
<?php
$subject = $_REQUEST['subject'] . ' - Personal website contact form submittion.'; // Subject of your email
$to = 'recipient@domain.com'; //Recipient's E-mail
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: Contact Form (Domain.com) <no-reply@domain.com>\r\n"; // Sender's E-mail
$headers .= "Reply-To: ".$_REQUEST['email']."<". $_REQUEST['email'].">\r\n" .
$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';
}
?>
// 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';
}
如何把reply-to header放在这里? Reply-to email 应该是填表时填写的email,不知道PHP 谁能帮帮我?谢谢
<?php
$subject = $_REQUEST['subject'] . ' - Personal website contact form submittion.'; // Subject of your email
$to = 'recipient@domain.com'; //Recipient's E-mail
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: Contact Form (Domain.com) <no-reply@domain.com>\r\n"; // Sender's E-mail
$headers .= "Reply-To: ".$_REQUEST['email']."<". $_REQUEST['email'].">\r\n" .
$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';
}
?>