reply-to address in php contact form

后端 未结 2 1098
没有蜡笔的小新
没有蜡笔的小新 2020-12-03 17:54

I bought a simple website template with a php contact form. Everything works great with the one small exception of actually receiving the messages sent via the form. That is

相关标签:
2条回答
  • 2020-12-03 18:36

    Try to use the header like this:

    $headers = array(
        'From' => $from,
        'To' => $to,
        'Cci' => $bcc,
        'Subject' => $subject,
        'Reply-To' => $reply_to
    );
    
    0 讨论(0)
  • 2020-12-03 18:53

    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

    0 讨论(0)
提交回复
热议问题