reply-to address in php contact form

三世轮回 提交于 2019-11-27 15:38:07

Try changing this part of your code :

$subject = "Contact Form: $name";
$message = "$message";
$headers = 'From: myemail@my_domain.com' . "\r\n" .
    'Reply-To: $email' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

To this :

$subject = "Contact Form: $name";
$message = "$message";
$headers = 'From: myemail@my_domain.com' . "\r\n" .
    'Reply-To: ' . $email . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

Basically take out the $email from inside the single quote and append it to that string

Try to use the header like this:

$headers = array(
    'From' => $from,
    'To' => $to,
    'Cci' => $bcc,
    'Subject' => $subject,
    'Reply-To' => $reply_to
);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!