5

How to add an email template for all emails that Joomla sent.

Is there any standard way to do this? Or do we have to add custom codes in each mail sending sections (or PHPmailer class)?

I'm looking for something like plugin events or something similar to catch an email sending event. Is this possible in Joomla?

I think I need to explain little bit more, Email Beautifier is Good one but its paid my aim is to develop such an extension. I have a custom component for email template customization, with editor all the styles fonts, etc are customizable from there the template is something like below.

enter image description here

This is my template I don't need to change any messages that Joomla already have with registration,contacts and so on. I just need to add a template on it,

Right now I am doing it with customizing PHP mailer class core file, something like Chad Windnagle said I already saw some extensions doing this like overriding all emails that Joomla send I used it in older version of Joomla like RS FORM PRO Joomla.

4 Answers 4

4

All the emails that are sent are sent using the language files, so changing the content to the email copy is a matter of doing language overrides:

http://docs.joomla.org/J2.5:Language_Overrides_in_Joomla

I'm not sure there is a specific single 'event' for catching email sending. The only way to do this would be to probably override the mailer class and add an event which you can then watch with other plugins.

You would have to override this class: https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/mail/mail.php

And replace it with your own - you could do that with a system plugin I think. From there you'll add a new event in the send() method which calls a plugin onSend event.

This will also only work if the email sending is using Joomla's mailer class. Any mail sent directly via PHP would be hard to catch this way.

0

Go to Language manager -> Language Overrides

There you can create overrides to following keys:

  • COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_SUBJECT

  • COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY

  • COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_SUBJECT

  • COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_BODY

There are other keys. But all you need is to create languages override. Take a look at the language/en-GB/en-GB.com_users.ini file.

2
  • 1
    You can use HTML and CSS here, but use ' instead of ". Alternatively, there is a good extension called E-mail beautifier, where you can change the template without needing to mess with the language files and the current messages. Apr 29, 2014 at 14:01
  • You don't need to mess with language files. You can override the messages without editing the files. I said to take a look at the file en-GB.com_users.ini to see all keys starting with COM_USERS_EMAIL. Alternatively you can search for COM_USERS_EMAIL in "Search text you want to change" when you are editing the language override. Set "Search for" to contant and search for COM_USERS_EMAIL.
    – csbenjamin
    Apr 29, 2014 at 14:21
0

EDIT: I re-read your question and realized you want to create a plugin similar to this. I'll leave my answer up though, as it could be useful to others based on your question title, and you may find it useful to look at how this extension works.

One alternative to this is to use the free cMandrill plugin from Compojoom:

https://compojoom.com/joomla-extensions/mandrill-transactional-emails-made-easy

And then sign up for http://Mandrill.com

The first 12,000 emails are free, so most websites won't ever see charges for it (you don't even need to use a credit card to sign up).

You can then override the joomla templates without modifying any language or making any overrides.

I offer this as an alternative that does have some nice benefits (like Mandrill can tell you if your user emails bounced back and who opened them, etc).

3
  • thanks for the answer, This is nice, but I want to create an extension! Component + plugin. In Joomla standard.
    – Jobin
    Apr 30, 2014 at 4:28
  • Mandrill (as of March 2016) is no longer free, they now require a paid mailchimp subscription.
    – user101289
    Mar 9, 2016 at 5:32
  • Yeah, it's a total bummer. I reached out to Compojoom and he's investigating it. He's looking at some other mail sending services that offer free tiers to see if they're interested in him making it work with theirs. So we'll see where it goes.
    – Brian Peat
    Mar 10, 2016 at 16:20
0

You can send email template easily by using free Joomla component like ACYMailing - https://www.acyba.com/

For features - https://www.acyba.com/acymailing/features.html

Also it has free email templates inbuilt so don't need to rebuild or creating yourself

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.