[Skip to main content](#vessel-content)

#   onBeforeMailSend - Only trigger for Orders emails?

##

- **[jhdesign](/forum/user/24410-jhdesign "View jhdesign's Profile")**
- [![jhdesign's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/24410-jhdesign "View jhdesign's Profile") Topic Author
- [ Offline](/forum/user/24410-jhdesign)

Less More

- Posts: 32
- Thank you received: 0
-
-

9 years 8 months ago [\#261698](#261698) by [jhdesign](/forum/user/24410-jhdesign "View jhdesign's Profile")  *[onBeforeMailSend - Only trigger for Orders emails?](/forum/30-integrations/888721-onbeforemailsend-only-trigger-for-orders-emails#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?")* was created by *[jhdesign](/forum/user/24410-jhdesign "View jhdesign's Profile")*

-- 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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84ODg3MjEtb25iZWZvcmVtYWlsc2VuZC1vbmx5LXRyaWdnZXItZm9yLW9yZGVycy1lbWFpbHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86315
- Thank you received: 14276
-
-

9 years 8 months ago [\#261704](#261704) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[onBeforeMailSend - Only trigger for Orders emails?](/forum/30-integrations/888721-onbeforemailsend-only-trigger-for-orders-emails#261704 "-- 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?")*

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-&gt;mail_name so that you only add the CC for the type of email you need.
For example:
if(!in_array($mail-&gt;mail_name , array('order_status_notification','order_notification', 'order_creation_notification'))) return;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84ODg3MjEtb25iZWZvcmVtYWlsc2VuZC1vbmx5LXRyaWdnZXItZm9yLW9yZGVycy1lbWFpbHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jhdesign](/forum/user/24410-jhdesign "View jhdesign's Profile")**
- [![jhdesign's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/24410-jhdesign "View jhdesign's Profile") Topic Author
- [ Offline](/forum/user/24410-jhdesign)

Less More

- Posts: 32
- Thank you received: 0
-
-

9 years 8 months ago [\#261815](#261815) by [jhdesign](/forum/user/24410-jhdesign "View jhdesign's Profile")  Replied by *[jhdesign](/forum/user/24410-jhdesign "View jhdesign's Profile")* on topic *[onBeforeMailSend - Only trigger for Orders emails?](/forum/30-integrations/888721-onbeforemailsend-only-trigger-for-orders-emails#261815 "-- 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?")*

Thanks, I'll try that.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84ODg3MjEtb25iZWZvcmVtYWlsc2VuZC1vbmx5LXRyaWdnZXItZm9yLW9yZGVycy1lbWFpbHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.083 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
