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

#   Custom Email Header

##

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

Less More

- Posts: 12
- Thank you received: 1
-
-

3 years 10 months ago [\#347875](#347875) by [MonkeyT12](/forum/user/69401-monkeyt12 "View MonkeyT12's Profile")  *[Custom Email Header](/forum/31-development/905612-custom-email-header#347875 "-- HikaShop version -- : 4.7 -- Joomla version -- : 4.2.3 -- PHP version -- : 8.1.11  I commonly include a custom email header in emails sent via Joomla's Mail class (e.g.: &quot;x-customname: sample;&quot;, which are added by using PhpMailer's -&gt;AddCustomHeader method on Joomla's Mail class, which extends PhpMailer). I'd like to include a similar header in Hikashop's generated emails, mostly to help me use rules to sort my incoming mail, but partly to do things like identifying which of HikaShop's templates was used or including custom data from custom plugins I occasionally write.  I know I could modify HikaShop's mail object, but is there some kind of override method or plugin process that wouldn't be overridden by updates?  Could you add this as a possible feature to include in a future update?")* was created by *[MonkeyT12](/forum/user/69401-monkeyt12 "View MonkeyT12's Profile")*

-- HikaShop version -- : 4.7
-- Joomla version -- : 4.2.3
-- PHP version -- : 8.1.11

I commonly include a custom email header in emails sent via Joomla's Mail class (e.g.: "x-customname: sample;", which are added by using PhpMailer's **-&gt;AddCustomHeader** method on Joomla's Mail class, which extends PhpMailer). I'd like to include a similar header in Hikashop's generated emails, mostly to help me use rules to sort my incoming mail, but partly to do things like identifying which of HikaShop's templates was used or including custom data from custom plugins I occasionally write.

I know I could modify HikaShop's mail object, but is there some kind of override method or plugin process that wouldn't be overridden by updates?

Could you add this as a possible feature to include in a future update?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwNTYxMi1jdXN0b20tZW1haWwtaGVhZGVyP3RtcGw9bWFya2Rvd24=) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

3 years 10 months ago [\#347877](#347877) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom Email Header](/forum/31-development/905612-custom-email-header#347877 "-- HikaShop version -- : 4.7 -- Joomla version -- : 4.2.3 -- PHP version -- : 8.1.11  I commonly include a custom email header in emails sent via Joomla's Mail class (e.g.: &quot;x-customname: sample;&quot;, which are added by using PhpMailer's -&gt;AddCustomHeader method on Joomla's Mail class, which extends PhpMailer). I'd like to include a similar header in Hikashop's generated emails, mostly to help me use rules to sort my incoming mail, but partly to do things like identifying which of HikaShop's templates was used or including custom data from custom plugins I occasionally write.  I know I could modify HikaShop's mail object, but is there some kind of override method or plugin process that wouldn't be overridden by updates?  Could you add this as a possible feature to include in a future update?")*

Hi,

It's already possible. You can implement the onBeforeMailSend(&amp;$mail, &amp;$mailer) event :
[ www.hikashop.com/support/documentation/6...tml#onBeforeMailSend](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#onBeforeMailSend)
in $mail, you'll have the data of the email, and in $mailer, you'll have the Joomla Mail class with the AddCustomHeader function.
So you can just create a plugin of the group "hikashop" with that event and call AddCustomHeader on $mailer based on the data in $mail.

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

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

Less More

- Posts: 12
- Thank you received: 1
-
-

3 years 10 months ago [\#348058](#348058) by [MonkeyT12](/forum/user/69401-monkeyt12 "View MonkeyT12's Profile")  Replied by *[MonkeyT12](/forum/user/69401-monkeyt12 "View MonkeyT12's Profile")* on topic *[Custom Email Header](/forum/31-development/905612-custom-email-header#348058 "-- HikaShop version -- : 4.7 -- Joomla version -- : 4.2.3 -- PHP version -- : 8.1.11  I commonly include a custom email header in emails sent via Joomla's Mail class (e.g.: &quot;x-customname: sample;&quot;, which are added by using PhpMailer's -&gt;AddCustomHeader method on Joomla's Mail class, which extends PhpMailer). I'd like to include a similar header in Hikashop's generated emails, mostly to help me use rules to sort my incoming mail, but partly to do things like identifying which of HikaShop's templates was used or including custom data from custom plugins I occasionally write.  I know I could modify HikaShop's mail object, but is there some kind of override method or plugin process that wouldn't be overridden by updates?  Could you add this as a possible feature to include in a future update?")*

Thanks. I didn't know if the $data value provided to the plugin was an actual Mail object or just a structure holding the requisite data.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwNTYxMi1jdXN0b20tZW1haWwtaGVhZGVyP3RtcGw9bWFya2Rvd24=) 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.065 seconds

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