3

I searched the web for last couple of days for "Reply-to Address" in the email but had no luck so, here I am.

In my wordpress site, there are multiple store owners who can sell their products. When visitors buy a certain item (listed by different owners), that particular owner gets an email notification (Note that it is mandatory to put the visitor's email address during checkout process)

However the email is from "Admin" email account.

I searched for how to set up "reply-to" address so the owners can reply directly to the customer's email address instead of admin account.

Here is an example that I saw which I am trying to achieve:

enter image description here

In this image, the site is abc.ca and the customer@gmail.com bought something. Then the owner@gmail.com got the email, which the owner can now send a reply back to the customer directly from the email.

How can I achieve something like this?

EDIT:

Here is the code that I have now:

 add_filter('woocommerce_email_headers', 'my_from_reply');
 function my_from_reply() {
 return 'From: my@email.here' . "\r\n";
 }

And this is the customer's billing email.

 <?php echo $order->billing_email; ?>

How can I modify the first one to include the "billing_email" instead of "my@email.here"

Thank you

  • Are you using some particular e-commerce solution? – Zlatev Mar 30 '15 at 5:28
  • yes. I am using woocommerce for that. =) – steve Kim Mar 30 '15 at 5:34
  • 2
    Without you showing the code that send the email it is impossible to answer the question. – Mark Kaplun Mar 30 '15 at 6:14
  • Well, there is no code. I could not even start on it, or don't even know where to even start from. – steve Kim Mar 30 '15 at 6:24
17

If and when you are using wp_mail(), then you can just set Reply-To for the $headers parameter. Exemplary usage below:

$to          = "abc@def.gh";
$subject     = "Using Reply-To with wp_mail";
$message     = "This is an example for using Reply-To with wp_mail.";
$headers[]   = 'Reply-To: Name Name <ijk@lmn.op>';
$attachments = array();
wp_mail( $to, $subject, $message, $headers, $attachments ); 

There is a hook wp_mail hook too, which you could use to change the parameters.

  • If I'm not mistaken WC uses wp_mail() and has a hook woocommerce_email_headers you can use. – Nicolai Mar 30 '15 at 12:51
  • So, I edited my original post to include the changes which needs some modification. Any suggestions to how I can edit it so that "billing_email" is can be returned. – steve Kim Mar 31 '15 at 3:38
  • So I tried some modification, but no luck. Any help will be much appreciated. Thanks. – steve Kim Mar 31 '15 at 6:54
  • I have never really done this with WC, I just remembered, there are some possibilities. So I can't give you immediate and concrete help. @steveKim – Nicolai Mar 31 '15 at 11:49
  • 2
    please note, the $headers array example in this answer is INCORRECT. It should be $headers = array('Reply-To: Name Name <ijk@lmn.op>'); It does NOT take an associative array. – Jared Henderson Jul 22 '16 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.