Pieter Posted September 30, 2016 Share Posted September 30, 2016 hi i fixed this in 1.6.0 with adding $list->addBcc('[email protected]'); on line 352 of tools/swift/swift.php but 1.6.1.7 has different files in swift. Where tot change this? thanks! Pieter Link to comment Share on other sites More sharing options...
Pieter Posted October 17, 2016 Author Share Posted October 17, 2016 anybody? Link to comment Share on other sites More sharing options...
bellini13 Posted October 17, 2016 Share Posted October 17, 2016 Switch to using a Mail class override. create a Mail.php file in your override\classes folder with the following contents. be sure to re-create the cache\class_index.php after installing the override file. <?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) { $bcc = '[email protected]'; return 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); } } 2 Link to comment Share on other sites More sharing options...
Pieter Posted October 17, 2016 Author Share Posted October 17, 2016 Hi Bellini, Installed and cache cleared, but no bcc copy in my mailbox... Link to comment Share on other sites More sharing options...
bellini13 Posted October 17, 2016 Share Posted October 17, 2016 then you likely did not re-create the class_index properly. Link to comment Share on other sites More sharing options...
Pieter Posted October 18, 2016 Author Share Posted October 18, 2016 Hi I deleted cache\class_index.php from the server. Prestashop then automatically makes a new one. If this is not the right way, please let me know. regards Pieter Link to comment Share on other sites More sharing options...
bellini13 Posted October 18, 2016 Share Posted October 18, 2016 open the class index file and confirm that the Mail.php override is being referenced. I assume you changed the email address in the override file to a valid email address? I tested the override file using one of my own email addresses, and it works just fine. Link to comment Share on other sites More sharing options...
Pieter Posted October 18, 2016 Author Share Posted October 18, 2016 OK thanks for your help! Link to comment Share on other sites More sharing options...
Novios Posted October 28, 2016 Share Posted October 28, 2016 I created the mail.php file in the mentioned folder. But I don't know what you mean with the next step. Can you explain me what exactly to do? Link to comment Share on other sites More sharing options...
Ventanazos Posted December 10, 2016 Share Posted December 10, 2016 (edited) open the class index file and confirm that the Mail.php override is being referenced. I assume you changed the email address in the override file to a valid email address? I tested the override file using one of my own email addresses, and it works just fine. Hi @bellini13 or to whom may help us We created a Mail.php file in override/classes folder, we changed the email address in the override file to a valid email address we just created fot this purpose. When we go to test, mail is sent to original recipient, but our bcc never arrives. We've regenerated the cache/class_index.php several times, but bbc is still not sent. We've opened the file to browse in it, but we cannot realize what string to exactly look for. Could you let us know what exactly should be found? We're working on PS 1.6.1.9 version, if its relevant. Thx in advance. Edited December 10, 2016 by Ventanazos (see edit history) Link to comment Share on other sites More sharing options...
MnRaf Posted December 20, 2016 Share Posted December 20, 2016 Why not use the Mail Alerts module? You can add multiple email addresses that way. Link to comment Share on other sites More sharing options...
bellini13 Posted December 20, 2016 Share Posted December 20, 2016 Why not use the Mail Alerts module? You can add multiple email addresses that way. because the question was how to copy yourself on ALL email, not just the order confirmation Link to comment Share on other sites More sharing options...
Ventanazos Posted December 21, 2016 Share Posted December 21, 2016 Why not use the Mail Alerts module? You can add multiple email addresses that way. Just as @bellini13 said "because the question was how to copy yourself on ALL email, not just the order confirmation", Actually, I'm using this hack on a PS 1.6.1.3 release, but it doesn't work any longer on 1.6.1.9, or at least I'm no able to make it work, may be I'm doing something wrong, so if you can a step by step recipe, it'll be grate. Thanks Link to comment Share on other sites More sharing options...
pietruzzo Posted April 3, 2017 Share Posted April 3, 2017 Switch to using a Mail class override. create a Mail.php file in your override\classes folder with the following contents. be sure to re-create the cache\class_index.php after installing the override file. <?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) { $bcc = '[email protected]'; return 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); } } Thanks. It works fine with 1.6.1.5 Link to comment Share on other sites More sharing options...
nuno.note Posted June 21, 2017 Share Posted June 21, 2017 it works perfectly Many thanks for the attribute presta 1.6.1.14 Link to comment Share on other sites More sharing options...
kimy Posted May 16, 2018 Share Posted May 16, 2018 Hi, Does this solution work for 1.7, or does it need any modification? Link to comment Share on other sites More sharing options...
bellini13 Posted May 16, 2018 Share Posted May 16, 2018 The solution should still work for PS v1.7, however it appears that a new module hook was added named "actionEmailSendBefore", and probably the better way is to create a module that registers that hook, and then you can register a BCC email address by updating the 'bcc' variable sent to that hook as a parameter Link to comment Share on other sites More sharing options...
kimy Posted May 16, 2018 Share Posted May 16, 2018 (edited) Thanks, I have no idea how to create a module that does that. But i'll give the old 1.6 way a try. Update: ok, i've tried this on 1.7.3.2 seems like it's working thanks! After you created the Mail.php file, go to advanced parameters --> performance and click save to update that file. Edited May 16, 2018 by kimy (see edit history) Link to comment Share on other sites More sharing options...
skulasinghe Posted May 21, 2018 Share Posted May 21, 2018 works for 1.6.1.4 thanks alot Link to comment Share on other sites More sharing options...
skulasinghe Posted May 21, 2018 Share Posted May 21, 2018 but not for domain name related email addresses Link to comment Share on other sites More sharing options...
jeffaries Posted November 15, 2018 Share Posted November 15, 2018 (edited) On 5/16/2018 at 2:34 PM, bellini13 said: The solution should still work for PS v1.7, however it appears that a new module hook was added named "actionEmailSendBefore", and probably the better way is to create a module that registers that hook, and then you can register a BCC email address by updating the 'bcc' variable sent to that hook as a parameter Hi, I confirm that it is working with "actionEmailSendBefore" in PS 1.7 I have done a small module that is actually adding may email address to the BCC recipients... of course, it can be improved (admin form etc) public function install() { return parent::install() && $this->registerHook('actionEmailSendBefore') ; } public function hookActionEmailSendBefore(&$param) { if (!isset($bcc)) { $param['bcc'] = []; } else if(!is_array($bcc)) { $bcc =$param['bcc']; $param['bcc'] = [$bcc]; } array_push($param['bcc'], '[email protected]'); return true; } I am not a PHP dev... so, I probably did some errors Edited November 15, 2018 by jeffaries (see edit history) Link to comment Share on other sites More sharing options...
heyho Posted September 5, 2021 Share Posted September 5, 2021 Used in 1.7.7 Only send order_conf to specific email: // $this->registerHook('actionEmailSendBefore'); public function hookActionEmailSendBefore(&$param) { if($param["template"] == "order_conf") { # or bankwire or ,..... if (is_array($param['bcc'])) { $param['bcc'][] = "[email protected]"; } else { $param['bcc'] = ["[email protected]"]; } } } 1 Link to comment Share on other sites More sharing options...
ConH Posted November 2, 2021 Share Posted November 2, 2021 (edited) Can someone explain to me how to transfer this code into a module? (v1.7.8) Edited November 2, 2021 by ConH (see edit history) 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