Skip to main content

onBeforeMailSend - Only trigger for Orders emails?

More
9 years 7 months ago #261698 by jhdesign
-- HikaShop version -- : 2.6.3

I'm using onBeforeMailSend in a custom plugin, works well.

However, it CC'd additional emails for ALL Hika related emails, including Cron Jobs.

Can it be limited to order emails only?

Please Log in or Create an account to join the conversation.

More
9 years 7 months ago #261704 by nicolas
Hi,

In the first parameter of the onBeforeMailSend trigger, you have the variable $mail which contains an attribute mail_name.
So you can check the value of $mail->mail_name so that you only add the CC for the type of email you need.
For example:
if(!in_array($mail->mail_name , array('order_status_notification','order_notification', 'order_creation_notification'))) return;

Please Log in or Create an account to join the conversation.

More
9 years 7 months ago #261815 by jhdesign
Thanks, I'll try that.

Please Log in or Create an account to join the conversation.

Time to create page: 0.210 seconds
Powered by Kunena Forum