Smart Subscriptions component sends email notifications to users and site administrator if a subscription is created or updated. The notification being sent depends on the event (the action on a subscription or payment). Email HTML templates used for notifications generation are stored in /administrator/helpers/emailtpl/ folder (admin/helpers/emailtpl in installation package zip file). Individual templates must be defined for each of the supported languages and placed into <lang-tag> subfolder (e.g. /administrator/helpers/emailtpl/en-GB for english).
If language-specific email template is not found for the current site language, en-GB will be used as a fallback. There is also a special folder for email template overrides: /administrator/helpers/emailtpl/overrides, it should have the similar structure as the main emailtmpl folder, i.e. have subfolders for each of the installed languages. When a notification is generated the script looks first in /overrides folder for a template required and loads it if found, otherwise a built-in template is used. You can leave "overrides" folder empty or override some of the templates only.
Types, template file names and descriptions are listed in the table below:
Event | Filename | Description |
---|---|---|
Administrator | admin.php | Subscription created by administrator in Joomla User manager |
Sign up | signup.php | New user registration and subscription assignment / pre-order |
Upgrade | upgrade.php | Existing user subscription renewal / upgrade / downgrade |
Modofication | status.php | Subscription status changed by administrator (e.g. set as paid for offline payment methods) |
Pre-access | preaccess.php | A free temporal account notice, for new registrations and when the payment is not online (the order has to be confirmed by administrator) |
Reset | reset.php | Reset to a free account notification, in case when current subscription expires or is suspended by administrator |
Bank transfer | offline.php | Data needed for bank transfer |
Expires soon | expires.php | Notification sent by cron task when account can be renewed with discount - "expires soon" (cron support will be added in v1.2.6) |
Expired | expired.php | Notification sent by cron task when account has already expired (cron support will be added in v1.2.6) |
Smart Subscriptions component sends HTML emails. Starting from version 1.2.6 common email markup is extracted from email templates and moved to /administrator/helpers/emailtpl/layout.php file. This file is language-independent and is used for all events and languages. If you wish to override default layout, create layout.php file in /administrator/helpers/emailtpl/overrides folder. Do not forget to include {%content} placeholder somewhere in layout file - this placeholder will be substituted by actual email template contents depending on the event and language.
If you override an email template, please, keep in mind that:
- No PHP code can be inserted into HTML. A PHP section is located on the top of the file and is stripped out from the resulting HTML before the email is sent. '?>' PHP closing tag is used as a delimiter, so HTML body cannot contain '?>' sequence
- You can place comments to your template override as PHP comments (before PHP closing tag)
- You can use ''COM_SMARTSUB_EMAIL_<custom_key>" in HTML where <custom_key> is replaced by a unique string ID (A-Z, 0-9 and '_' characters allowed). Do not forget to add resulting language keys to translation file(s)
- Special "{%data_key}" placeholders are used in HTML template and will be replaced by the real data on the fly. For data keys meaning see comments to SmartsubHelper::processEmailTpl(...) method in smartsub.php hepler script
Images in notification emails
There are special data keys supported in email templates: {%logo_image_url}, {%header_image_url}, {%footer_image_url}. They should be used as "scr" attribute in <img /> elements. Built-in templates propose these images for use as:
- {%header_image_url} - 100% wide banner image on top
- {%footer_image_url} - 100% wide banner image at bottom
- {%logo_image_url} - small image within email text flow
If you override email template(s) feel free to change images position, size and style. Important note: Images will not be rendered at all if they are not defined in Smart Subscriptions global component settings.