Jump to content
Pieter

1.6.1 bcc all mail to shopowner

Recommended Posts

hi

 

i fixed this in 1.6.0 with adding  $list->addBcc('info@xxxx.nl'); on line 352 of tools/swift/swift.php but 1.6.1.7 has different files in swift.

Where tot change this?

 

thanks!

 

Pieter

Share this post


Link to post
Share on other sites

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 =     'info@xxxx.nl';

        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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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.

 

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)

Share this post


Link to post
Share on other sites

Why not use the Mail Alerts module? You can add multiple email addresses that way.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

 

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 =     'info@xxxx.nl';

        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

Share this post


Link to post
Share on other sites

Hi,

Does this solution work for 1.7, or does it need any modification?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites
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'], 'myaddress@gmail.com');
		
	   
       return true;
    }

I am not a PHP dev... so, I probably did some errors

Edited by jeffaries (see edit history)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More