Change Mail-From And Reply-To For All Order-Mails

Hello,



what we want to achieve is that all order notification mails that are being sent to the customer do have the same Mail-From and Reply-To mail adress. We want it to be the store admin mail address.



Currently the Mail-From and Reply-To address of the order notification mails is always the one of the vendor…



What files, hooks do we have to edit / create / use to accomplish our goal?



best regards,

Alex

Probably adjustments to the Mailer class to have it use the store credentials rather than the vendor credentials. But why don't you want the vendor to get the emails? Seems like you've be creating extra steps for yourself. Wouldn't it be better to use a php hook for 'send_mail_pre' to add a BCC to the email?

[quote name='apr3455' timestamp='1415785540' post='196706']

Hello,



what we want to achieve is that all order notification mails that are being sent to the customer do have the same Mail-From and Reply-To mail adress. We want it to be the store admin mail address.



Currently the Mail-From and Reply-To address of the order notification mails is always the one of the vendor…



What files, hooks do we have to edit / create / use to accomplish our goal?



best regards,

Alex

[/quote]



app/Tygh/Mailer.php



$mailer->SetFrom($from['email'], $from['name']);

Hi eComLabs,



thanks but this would globaly change the “from” address for all mails being sent, wouldn't it?

We only want to change it for order mails.



Other mails like requests (addon) must not have the store admin mail address…



Any idea?



best regards,

Alex

[quote name='apr3455' timestamp='1415952915' post='196967']

Hi eComLabs,



thanks but this would globaly change the “from” address for all mails being sent, wouldn't it?

We only want to change it for order mails.



Other mails like requests (addon) must not have the store admin mail address…



Any idea?

[/quote]



Yes, you are right. To change the “from e-mail” for the orders only, please open the app/functions/fn.cart.php file, find the fn_order_notification function and this part of code:



if ($notify_user == true) {
Mailer::sendMail(array(
'to' => $order_info['email'],
'from' => 'company_orders_department',




you can replace the company_orders_department with the required e-mail. E.g.



if ($notify_user == true) {
Mailer::sendMail(array(
'to' => $order_info['email'],
'from' => 'abc@def.com',

Thanks eComLabs!



I have come up with following solution:



Addon: my_changes:


function fn_my_changes_send_order_notification(&$order_info, $edp_data, $force_notification, $notified, $send_order_notification){<br />
  $order_info['company_id'] = 6;<br />
}
```<br />
<br />
6 is the ID of the Vendor who is also the owner of the shop... <img src="upload://rA9Qa8gnUPZzRZRdI8kt3dpjkrs.png" class="bbc_emoticon" alt=":)"><br />
So it always uses the mail address of vendor with ID: 6 for the order notification mails.<br />
<br />
best regards,<br />
Alex

[quote name=‘apr3455’ timestamp=‘1416577560’ post=‘197623’]

Thanks eComLabs!



I have come up with following solution:



Addon: my_changes:


function fn_my_changes_send_order_notification(&$order_info, $edp_data, $force_notification, $notified, $send_order_notification){<br />
  $order_info['company_id'] = 6;<br />
}
```<br />
<br />
6 is the ID of the Vendor who is also the owner of the shop... <img src="upload://rA9Qa8gnUPZzRZRdI8kt3dpjkrs.png" class="bbc_emoticon" alt=":)"><br />
So it always uses the mail address of vendor with ID: 6 for the order notification mails.<br />
<br />
best regards,<br />
Alex<br />
[/quote]<br />
<br />
Hi,<br />
<br />
I am new to CS-Cart and not very techy. I just read and do things for now. Could you guide me, step by step, How to do this?

[quote name='eComLabs' timestamp='1415871161' post='196879']

app/Tygh/Mailer.php



$mailer->SetFrom($from['email'], $from['name']);


[/quote]

Hi, where to insert this code in app/Tygh/Mailer.php? At end or anywhere else?

Thank you in advance

[quote name='majerfra' timestamp='1433488342' post='217425']

Hi, where to insert this code in app/Tygh/Mailer.php? At end or anywhere else?

Thank you in advance

[/quote]



I suggest you to use solution from post #5

[quote name='eComLabs' timestamp='1433500519' post='217472']

I suggest you to use solution from post #5

[/quote]

Ok, but I want the new user registration also send from same mail.as

which file to edit for new user notification, fn.users.php?

[quote name='majerfra' timestamp='1433503109' post='217493']

Ok, but I want the new user registration also send from same mail.as

which file to edit for new user notification, fn.users.php?

[/quote]



You are right, please find the following code in the fn_update_user function:



if (!empty($notify_user)) {
$from = 'company_users_department';