Jump to content

1.6.1 bcc all mail to shopowner


Pieter

Recommended Posts

  • 3 weeks later...

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);

    }

}

  • Like 2
Link to comment
Share on other sites

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

  • 2 weeks later...
  • 1 month later...

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 by Ventanazos (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

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

  • 3 months later...

 

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

  • 2 months later...
  • 10 months later...

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

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 by kimy (see edit history)
Link to comment
Share on other sites

  • 5 months later...
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 by jeffaries (see edit history)
Link to comment
Share on other sites

  • 2 years later...
  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...