- Posts: 32
- Thank you received: 0
onBeforeMailSend - Only trigger for Orders emails?
9 years 7 months ago #261698
by jhdesign
onBeforeMailSend - Only trigger for Orders emails? was created 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?
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.
9 years 7 months ago #261704
by nicolas
Replied by nicolas on topic onBeforeMailSend - Only trigger for Orders emails?
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;
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.
9 years 7 months ago #261815
by jhdesign
Replied by jhdesign on topic onBeforeMailSend - Only trigger for Orders emails?
Thanks, I'll try that.
Please Log in or Create an account to join the conversation.
Time to create page: 0.210 seconds