我是使用php的新手,我购买了一个带有集成PHP联系表单的网站模板。当我收到客户的电子邮件并点击回答他们的问题时,它不会自动使用他们的电子邮件地址进行回复。
我知道有一个"回复"我可以在我的代码中使用,以确保它在我的邮件客户端上单击回复时将使用客户地址。我只是不知道如何使用它。
这是我的代码:
<?php
$to = 'info@webmaster.ca'; // Put in your email address here
$subject = "Formulaire de contact"; // The default subject. Will appear by default in all messages. Change this if you want.
// User info (DO NOT EDIT!)
$fname = stripslashes($_REQUEST['fname']); // sender's name
$email = stripslashes($_REQUEST['email']); // sender's email
$subject = stripslashes($_REQUEST['subject']);
$message = stripslashes($_REQUEST['message']);
// The message you will receive in your mailbox
// Each parts are commented to help you understand what it does exaclty.
// YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION!
$msg .= "Nom: ".$fname."\r\n\n"; // add sender's name to the message
$msg .= "Courriel: ".$email."\r\n\n"; // add sender's email to the message
$msg .= "Sujet: ".$subject."\r\n\n"; // add sender's name to the message
$msg .= "-----Commentaire------: ".$message."\r\n\n"; // add sender's email to the message
$msg .= "\r\n\n";
$mail = @mail($to, $subject, $msg, "De:".$email); // This command sends the e-mail to the e-mail address contained in the $to variable
if($mail) {
header("Location:index.php");
} else {
echo 'Envoi du message a échoué!'; //This is the message that will be shown when an error occured: the message was not send
}
?>
答案 0 :(得分:0)
只需在From
的第四个参数中添加Reply-To
或mail()
标题。
编辑:
您现在拥有的"De:".$email
as stated in comments,是“From”的法语。语法是特定于语言的,必须是英语。