在 php 中制作自动回复器
Making an autoresponder in php
我有一个网站,上面有联系表格。当有人使用它时,我会收到消息。但是我想设置一个自动回复器来通知联系我的人他们的信息已经收到等等
代码:
<?php
$data = json_decode(file_get_contents('admin/data/contact.txt'));
include('includes/header.php');
if(isset($_REQUEST['name'])) {
$to = $settings->email;
$subject = 'Contact from Website';
$headers = "From: " . strip_tags($_REQUEST['email']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_REQUEST['email']) . "\r\n";
//$headers .= "CC: susan@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "Hi, A message from contact form.";
$message .= "<br /><br /><br />Name: ".$_REQUEST['name'];
$message .= "<br />Email: ".$_REQUEST['email'];
$message .= "<br />Subject: ".$_REQUEST['subject'];
$message .= "<br />Message: ".$_REQUEST['message'];
mail($to, $subject, $message, $headers);
$msg = 'Your Message has been sent. Thank You.';
}
$btn = '<input type="submit" style="font-size: 14px; font-style: normal; height: auto; color: #fff; border-radius: 15px; border: none;" class="btn_new" value="SEND" />';
?>
如何编辑此代码以进行设置?
谢谢
....
....
$message .= "<br />Message: ".$_REQUEST['message'];
if(@mail($to, $subject, $message, $headers))
{
echo "Mail Sent Successfully";
//Send autoresponder email to $_REQUEST['email'];
//inform the person who contacted me that their message has been received etc.
}
else
{
echo "Mail Not Sent";
}
我有一个网站,上面有联系表格。当有人使用它时,我会收到消息。但是我想设置一个自动回复器来通知联系我的人他们的信息已经收到等等
代码:
<?php
$data = json_decode(file_get_contents('admin/data/contact.txt'));
include('includes/header.php');
if(isset($_REQUEST['name'])) {
$to = $settings->email;
$subject = 'Contact from Website';
$headers = "From: " . strip_tags($_REQUEST['email']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_REQUEST['email']) . "\r\n";
//$headers .= "CC: susan@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "Hi, A message from contact form.";
$message .= "<br /><br /><br />Name: ".$_REQUEST['name'];
$message .= "<br />Email: ".$_REQUEST['email'];
$message .= "<br />Subject: ".$_REQUEST['subject'];
$message .= "<br />Message: ".$_REQUEST['message'];
mail($to, $subject, $message, $headers);
$msg = 'Your Message has been sent. Thank You.';
}
$btn = '<input type="submit" style="font-size: 14px; font-style: normal; height: auto; color: #fff; border-radius: 15px; border: none;" class="btn_new" value="SEND" />';
?>
如何编辑此代码以进行设置?
谢谢
....
....
$message .= "<br />Message: ".$_REQUEST['message'];
if(@mail($to, $subject, $message, $headers))
{
echo "Mail Sent Successfully";
//Send autoresponder email to $_REQUEST['email'];
//inform the person who contacted me that their message has been received etc.
}
else
{
echo "Mail Not Sent";
}