onBeforeMailSend - Only trigger for Orders emails?

  • Posts: 32
  • Thank you received: 0
7 years 9 months ago #261698

-- 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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 9 months ago #261704

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.

  • Posts: 32
  • Thank you received: 0
7 years 9 months ago #261815

Thanks, I'll try that.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum