How to add "Reply To" with WooCommerce Customer Name and Email

1

Hello,

I have a problem with this part, I would like to set the Client name instead of just the E-mail when clicking Reply. Here is the code I used to work "Reply To":

add_filter( 'woocommerce_email_headers', 'add_reply_to_wc_admin_new_order', 10, 3 );

function add_reply_to_wc_admin_new_order( $headers = '', $id = '', $order ) {
    if ( $id == 'new_order' ) {
        $headers .= "Reply-To: ".$order->billing_email."\r\n"; 
    }
   return $headers;
}

As you can see this code works as follows, when responding to the new Order E-mail from WooCommerce it will respond to the Customer's Email filled in on the Store Billing Form. I would like to also put the Client's name.

One example I'm trying to explain is PHPMailer that works like this:

$mailer->AddReplyTo($_POST["email"], $_POST["nome"]);

In this PHPMailer template when clicking on reply it does more or less this:

Rodrigo Macedo <[email protected]>, 

Does anyone have an idea how I can do this?

I've tried adding the code in the name in front of PHPMailer's email in many ways, but without success ...

    
asked by anonymous 22.11.2016 / 20:22

1 answer

1

In the same way that you enter the client's email:

$headers .= "Reply-To: [email protected]"; 

You must enter the name into a pattern that you yourself have entered:

$headers .= "Reply-To: Nome Cliente <[email protected]>"; 

If you want to send someone else, add commas:

$headers .= "Reply-To: Nome Cliente <[email protected]>, Segundo Cliente <[email protected]>";

It can also be checked in the comments in the manual: link

    
23.11.2016 / 14:39