Templates

In the templates view you'll be able to create a global HTML template that is going to be used when sending emails through Mandrill. Further more you can create templates just for specific extensions. For example you can have a global template that is used by all extensions, but for com_users you can have a customised template that gives newly registered users a coupon code along with their registration.

[Note]Note

The HTML templates should be created directly in Mandrill. In CMandrill you just assign those templates.

Creating a template

On the template view click the new button. You'll be presented with a form that you need to fill out and save.

Fields:

  • title - enter a title for this HTML template. The title is only visible in the backend and is used to help you figure out what the template is actually for.

  • Status - the status of the template can be either publish or unpublished. Unpublished templates won't be used when sending emails

  • Start publishing & Finish Publishing - if you specify a timeframe here the template will be only used when the timeframe is met

  • Mandrill Template - from this drop down field select the Mandrill template that this template is using.

  • Component - Use global if this template is meant to be used for the whole website. Use other if you are defining a template for a specific task

  • Class name - the PHP class name that is sending the mail

  • Function name - the PHP function in the class that is sending the mail

[Note]Note

You may be wondering - how do I find the class name and function name. Well if you are developer, you could always use the your favorite code editor and dig into the code. On the other hand there is a much easier way! Just trigger the task that you need a custom template for. Once you do, look at the activity tab in mandrill . You'll notice that the sent email has 2 tags -> one starting with class_ and the other one starting with function_ . Those are your class name and function name. Just copy the part after the underscore and you are ready to go!

Example 3.1. Example - custom template for the Registration view

1. On your site navigate to the registration view.

2. Fill out all the details and click register.

3. Login in mandrillapp.com and look at the activity tab. The mail that was sent about the registration has the following tags: class_UsersModelRegistration & function_register

4. Now go to CMandrill -> templates -> new. For component select other, for class name enter UsersModelRegistration and for function name enter register. Save the template

5. That's it! Now the Joomla registration emails will be sent using the template that you've specified!