0

我有一个有联系表的网站。当有人使用它时,我会收到消息。但我想设置一个自动回复器来通知与我联系的人他们的消息已收到等。

代码:

<?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" />';
?>

如何编辑此代码以进行设置?

谢谢

4

1 回答 1

1
....
....
$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";
}
于 2018-09-25T05:54:45.553 回答