I have been trying to add reply to email into the wordpress function wp_mail. So, I did as:

$subject = 'Inquiry from ' . $_REQUEST['first_name'] . ' ' . $_REQUEST['last_name'];
$headers = 'From: ' . $_REQUEST['first_name'] . ' <' . $_REQUEST['email_address'] . '>' . "rn";
if( wp_mail('to@example.com', $subject, $email_template, $header ) ){
    echo "sent";

In the header section if I add email address as hardcoded it works, i.e.

$headers = 'From: ' . $_REQUEST['first_name'] . ' <from@example.com>' . "rn";

But when I put variable instead of hardcoded, it doesn’t work. Please can you tell me anyone how to fix it?

Read more here: From email couldn’t be added in wp_mail in wordpress


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: