Zen Cart Logo
Forums / Managing Customers and Orders / [NEW ORDER] Reply Email Address as Customer -- FIX!

[NEW ORDER] Reply Email Address as Customer -- FIX!

Views: 2,287

Results 1 to 7 of 7
24 Jan 2013, 7:42 PM
#1
evenangelsdie avatar

evenangelsdie

New Zenner

Join Date:
Oct 2008
Posts:
31
Plugin Contributions:
0

[NEW ORDER] Reply Email Address as Customer -- FIX!

I searched everywhere for an answer for this, and all I found were closed threads with solutions that didn't work with the newer versions of Zen Cart.

My issue was that I needed the "reply-to" address of the order copy emails to be that of the customer so my client could easily just hit the "reply" button in Outlook instead of going into the store's admin area and submitting a note to them that way. As it was, the reply address was set to the store's default email address, so clicking "reply" sent a message back to the store. Client was not happy about this as he hated having to copy and paste the email address from the order into the reply field of a new message. After much searching and trying solutions that just didn't work, I played around with the order.php file and have the solution here for anyone else who had been looking for a way to do this.

at the bottom of includes/classes/order.php, find:

$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);

Replace with:

$email_order . $extra_info['TEXT'], $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $html_msg, 'checkout_extra', $this->attachArray);

This will show the "From" as the customer name instead of the store name, and the reply-to email as the customer, not the store.
In your Admin > Email Options make sure "must send emails from known domain" is false.

Hope it helps someone else!

24 Jan 2013, 8:17 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: [NEW ORDER] Reply Email Address as Customer -- FIX!

Thanks for posting this! My partners have been bugging me to fix this annoying behavior.

24 Jan 2013, 8:30 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [NEW ORDER] Reply Email Address as Customer -- FIX!

evenangelsdie:

This will show the "From" as the customer name instead of the store name, and the reply-to email as the customer, not the store.
In your Admin > Email Options make sure "must send emails from known domain" is false.If that works for your specific case, fine.
But beware of spam filters being triggered when you do that.
You are essentially "spoofing" the email to make it "look like" it's coming from the customer by giving a fake "from" address when in fact it's actually coming from YOU (your store, ie: your store's domain name is different from the customer's domain name). Be prepared for the potential of lost or rejected (or worse, dropped without notice) emails.

25 Jan 2013, 6:26 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: [NEW ORDER] Reply Email Address as Customer -- FIX!

So is there any safe way around this? "Contact Us" e-mails are always from another person, even if they are sent through the store, and "reply" always wants to go by default to the person who wrote, not the store. Is there a way to make the reply-to match the writer's e-mail without spoofing the sent-from? Hitting reply and having the message not go to the desired recipient without remembering to copy and paste an address causes a lot of stress for ordinary staff.

25 Jan 2013, 6:52 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [NEW ORDER] Reply Email Address as Customer -- FIX!

Here's what I'm considering proposing for v1.6.0 ...

orders.php:```
$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray[B], $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'][/B]);


functions_email.php:

function zen_mail($to_name, $to_address, $email_subject, $email_text, $from_email_name, $from_email_address, $block=array(), $module='default', $attachments_list=''[B], $email_reply_to_name = '', $email_reply_to_address = '' [/B]) {

and```
      // If sending from [B]checkout or[/B] contact-us or tell-a-friend page, use the supplied info
      $email_reply_to_address = (isset($email_reply_to_address) && $email_reply_to_address != '') ? $email_reply_to_address : (in_array($module, array('contact_us',  'tell_a_friend'[B], 'checkout_extra'[/B])) ? $from_email_address : EMAIL_FROM);
      $email_reply_to_name    = (isset($email_reply_to_name) && $email_reply_to_name != '')    ? $email_reply_to_name    : (in_array($module, array('contact_us',  'tell_a_friend'[B], 'checkout_extra'[/B])) ? $from_email_name    : STORE_NAME);

Feel free to try it out and report whether it solves the problem you're facing.

25 Jan 2013, 6:05 PM
#6
evenangelsdie avatar

evenangelsdie

New Zenner

Join Date:
Oct 2008
Posts:
31
Plugin Contributions:
0

Re: [NEW ORDER] Reply Email Address as Customer -- FIX!

DrByte:

If that works for your specific case, fine.
But beware of spam filters being triggered when you do that.
You are essentially "spoofing" the email to make it "look like" it's coming from the customer by giving a fake "from" address when in fact it's actually coming from YOU (your store, ie: your store's domain name is different from the customer's domain name). Be prepared for the potential of lost or rejected (or worse, dropped without notice) emails.

Thank you, yes I took that into consideration. Unfortunately I couldn't find another way to do this and it was necessary. I had done something similar for him many years ago with an older version of Zencart and there were no issues with this fortunately. I'm not too worried, since Paypal is set as the default payment method anyways, and the Paypal order email would always still come through. So, even if an order email was marked as spam he would still know that there was an order because of the Paypal email. In that case he could just go through the admin area to retrieve it. If this is updated in the next version as you proposed that would be that would be great!

12 Jun 2013, 8:10 PM
#7
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

Re: [NEW ORDER] Reply Email Address as Customer -- FIX!

DrByte:

Here's what I'm considering proposing for v1.6.0 ...

orders.php:```
$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray[B], $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'][/B]);

> 
> functions_email.php:
> ```
  function zen_mail($to_name, $to_address, $email_subject, $email_text, $from_email_name, $from_email_address, $block=array(), $module='default', $attachments_list=''[B], $email_reply_to_name = '', $email_reply_to_address = '' [/B]) {

and```
// If sending from [B]checkout or[/B] contact-us or tell-a-friend page, use the supplied info
$email_reply_to_address = (isset($email_reply_to_address) && $email_reply_to_address != '') ? $email_reply_to_address : (in_array($module, array('contact_us', 'tell_a_friend'[B], 'checkout_extra'[/B])) ? $from_email_address : EMAIL_FROM);
$email_reply_to_name = (isset($email_reply_to_name) && $email_reply_to_name != '') ? $email_reply_to_name : (in_array($module, array('contact_us', 'tell_a_friend'[B], 'checkout_extra'[/B])) ? $from_email_name : STORE_NAME);

> 
> Feel free to try it out and report whether it solves the problem you're facing.

Works excellently DrByte, thank you so much for that!