grumpyomg Posted May 16, 2017 Share Posted May 16, 2017 (edited) Is there a way to send a blind copy of order confirmation emails? After reading https://www.prestashop.com/forums/topic/550476-order-mails-bcc/ I've set up classes/Mail.php to send blind copies of all emails but Ideally I really only want to send copies of order confirmation emails. In it's current setup I get blind copies of registration , payment accepted emails as well etc. I'm using prestashop 1.6.1.9 Any help would be appreciated. Edited May 16, 2017 by grumpyomg (see edit history) Link to comment Share on other sites More sharing options...
selectshop.at Posted May 16, 2017 Share Posted May 16, 2017 For to receive a copy of an order placed you only need to activate module "mail alerts" - > merchant notifications -> NEW ORDER = YES Link to comment Share on other sites More sharing options...
grumpyomg Posted May 17, 2017 Author Share Posted May 17, 2017 Thanks for the reply. I'm trying to send a BCC email to trustpilot AFS 2.0 on order confirmation. I've tried using mail alerts previously but I don't think they are sent BCC rather a new email is generated and sent to the added email addresses. Any other suggestions on implementing trustpilot AFS? Link to comment Share on other sites More sharing options...
bellini13 Posted May 17, 2017 Share Posted May 17, 2017 PS v1.6.1.9 supports the BCC option when sending mails. So you could still use mailalerts to send the merchant the new order email, and then you could override or customization the mailalerts module so that it adds the email address as BCC when sending the new order alert email. I don't know what version of MailAlerts module you are using, but here is an example of the code you could use directly after $id_shop variable is where you would add the email address for BCC. Make sure to add a comma after $id_shop if ($dir_mail) Mail::Send( $mail_id_lang, 'new_order', sprintf(Mail::l('New order : #%d - %s', $mail_id_lang), $order->id, $order->reference), $template_vars, $merchant_mail, null, $configuration['PS_SHOP_EMAIL'], $configuration['PS_SHOP_NAME'], null, null, $dir_mail, null, $id_shop, '[email protected]', ); Link to comment Share on other sites More sharing options...
grumpyomg Posted May 17, 2017 Author Share Posted May 17, 2017 I'm using mail alerts v3.6.1. I tried updating mailalerts.php with the above changes but it failed to work. To allow trustpilot afs to work I need the customer email to be in the 'to' field and trustpilot email in the BCC. By adding the above BCC I think trustpilots automatic feedback email will be sent to the admin email rather than the customer. I thought it would be straightforward to use trustpilot afs but has proven more difficult than I thought. Thanks for the help. Any other ideas? Link to comment Share on other sites More sharing options...
bellini13 Posted May 17, 2017 Share Posted May 17, 2017 if the customers email has to be in the To field, then you can't use mailalerts module for this. It does not send the email to the customer. The alternative is to override or customize the PaymentModule class. It is responsible for sending the order confirmation email to the customer. It would be a similar change as noted above. Link to comment Share on other sites More sharing options...
Claust Posted June 14, 2017 Share Posted June 14, 2017 Need the same change here (also for trustpilot), did you get it to work? Link to comment Share on other sites More sharing options...
grumpyomg Posted June 16, 2017 Author Share Posted June 16, 2017 Got the trustpilot AFS to work in version 1.6.1.9 using the help above. In the PaymentModule.php class find this code. if (Validate::isEmail($this->context->customer->email)) { Mail::Send( (int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $this->context->customer->email, $this->context->customer->firstname.' '.$this->context->customer->lastname, null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int)$order->id_shop ); and replace with if (Validate::isEmail($this->context->customer->email)) { Mail::Send( (int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $this->context->customer->email, $this->context->customer->firstname.' '.$this->context->customer->lastname, null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int)$order->id_shop, '*********@invite.trustpilot.com' ); Replacing the ********* with your trustpilot AFS address. 1 Link to comment Share on other sites More sharing options...
ANGELO Vintage Posted June 22, 2017 Share Posted June 22, 2017 (edited) i prefer to override the mail.php class to send a mail copy to trustpilot only when "shipped" template is sent, but don't know if is correct this way: <?php class Mail extends MailCore { public static function Send($id_lang, $template, $subject, $template_vars, $to, $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null) { // send to Trustpilot SFA 2.0 if($template == 'shipped') { // send to trustpilot parent::Send($id_lang, $template, $subject, $template_vars, "*********@invite.trustpilot.com", $to_name, $from, $from_name, $file_attachment, $mode_smtp, $template_path, $die, $id_shop, $bcc, $reply_to); } } ?> Edited June 22, 2017 by ANGELO Vintage (see edit history) Link to comment Share on other sites More sharing options...
Claust Posted June 22, 2017 Share Posted June 22, 2017 Has this been tested? billini13's solution in #4 works for me on Presta 1.6.1.14, but I'm unsure when in the order flow the email is sent to Trustpilot? I believe the email is sent when the payment is fulfilled, which is the same time as the products are sent in my case. Link to comment Share on other sites More sharing options...
ANGELO Vintage Posted June 22, 2017 Share Posted June 22, 2017 (edited) or is possible to add a bcc destination only like: <?php class Mail extends MailCore { public static function Send($id_lang, $template, $subject, $template_vars, $to, $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null) { // add trustpilot SFA 2.0 if($template == 'shipped') { $bcc->addBcc('*********@invite.trustpilot.com'); } // send to customer $ret = parent::Send($id_lang, $template, $subject, $template_vars, $to, $to_name, $from, $from_name, $file_attachment, $mode_smtp, $template_path, $die, $id_shop, $bcc, $reply_to); return $ret; } ?> Thanks for any help Edited June 22, 2017 by ANGELO Vintage (see edit history) Link to comment Share on other sites More sharing options...
ANGELO Vintage Posted June 22, 2017 Share Posted June 22, 2017 (edited) Has this been tested? billini13's solution in #4 works for me on Presta 1.6.1.14, but I'm unsure when in the order flow the email is sent to Trustpilot? I believe the email is sent when the payment is fulfilled, which is the same time as the products are sent in my case. i Already using mail allert module specifing the 2 emails but other problem is when a customer order and then call to delete the order. the trustpilot email (order confirmation) is already sent. The only solution is to send a trustpilot email when you change order status to "shipped", because you are sure that customer is waiting and payed it Edited June 22, 2017 by ANGELO Vintage (see edit history) Link to comment Share on other sites More sharing options...
ANGELO Vintage Posted June 22, 2017 Share Posted June 22, 2017 I'm using mail alerts v3.6.1. I tried updating mailalerts.php with the above changes but it failed to work. To allow trustpilot afs to work I need the customer email to be in the 'to' field and trustpilot email in the BCC. By adding the above BCC I think trustpilots automatic feedback email will be sent to the admin email rather than the customer. I thought it would be straightforward to use trustpilot afs but has proven more difficult than I thought. Thanks for the help. Any other ideas? the new system need to read a specific code inside the email template: <script type="application/json+trustpilot"> { "recipientEmail": "CUSTOMER EMAIL", "recipientName": "CUSTOMER NAME", "referenceId": "ORDER ID" } </script> Link to comment Share on other sites More sharing options...
ltd Posted June 1, 2018 Share Posted June 1, 2018 (edited) On 2017年6月17日 at 7:00 AM, grumpyomg said: Got the trustpilot AFS to work in version 1.6.1.9 using the help above. In the PaymentModule.php class find this code. if (Validate::isEmail($this->context->customer->email)) { Mail::Send( (int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $this->context->customer->email, $this->context->customer->firstname.' '.$this->context->customer->lastname, null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int)$order->id_shop ); and replace with if (Validate::isEmail($this->context->customer->email)) { Mail::Send( (int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $this->context->customer->email, $this->context->customer->firstname.' '.$this->context->customer->lastname, null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int)$order->id_shop, '*********@invite.trustpilot.com' ); Replacing the ********* with your trustpilot AFS address. Hi, I have updated the class with my email to send as BCC. It seems to work: I see the mail being logged as "sent", but I don't receive anything. The order confirmation mail is properly sent so it is not a problem of mailer. any idea ? Edited June 1, 2018 by ltd (see edit history) Link to comment Share on other sites More sharing options...
guitarmonia Posted December 13, 2023 Share Posted December 13, 2023 On 6/17/2017 at 12:00 AM, grumpyomg said: Got the trustpilot AFS to work in version 1.6.1.9 using the help above. In the PaymentModule.php class find this code. if (Validate::isEmail($this->context->customer->email)) { Mail::Send( (int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $this->context->customer->email, $this->context->customer->firstname.' '.$this->context->customer->lastname, null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int)$order->id_shop ); and replace with if (Validate::isEmail($this->context->customer->email)) { Mail::Send( (int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $this->context->customer->email, $this->context->customer->firstname.' '.$this->context->customer->lastname, null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int)$order->id_shop, '*********@invite.trustpilot.com' ); Replacing the ********* with your trustpilot AFS address. This still works as of 2023. Much much thanks! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now