Infradox XS 26.1 - all versions
9 February 2016 added information re custom e-mail forms in v27.2
Infradox XS needs to be configured with an e-mail account that the website can use to send notifications about new users registering, new or changed orders, quote requests and so on. But also to allow your website users to send links to e.g. galleries, preview pages and lightboxes. You can find more information about configuring e-mail for your website in the article XS first time configuration.
The website uses a number of e-mail templates that are centrally stored. It is possible to edit the text of those templates. If you do, a local copy will be stored and that copy will then be used to generate the e-mail.
You can find an overview of all templates and their uses in the article about localisation.
Templates and localisation
To change the text of an e-mail template, go to Site configuration and click on e-mail templates.
In the dropdown at the top, select the language that you want to see and/or change. After you have selected a language, the top list shows all the templates that XS uses. These are the standard templates. If there's a local/changed copy of a template, it will display with a star icon in front of its name. Click a template to open the editor. If you save the template, a local copy will be created and used from then on. Local copies (i.e. changed templates) are shown in the list at the bottom. To change a local copy of a template, click its name in the list of modified templates. If you want to restore the original template then simply delete the local copy in the list at the bottom.
If your website uses more than one language, you may want to change the templates for each language. Change the language dropdown at the top to list the templates for that language / locale. However, the templates that are used to send notifications to administrators (e.g. of new orders etc) are not localised. The English version is used always.
E-mail template codes
The templates have codes that will be replaced by the software. For instance the code [signature] can be used in a template to automatically insert your company name and contact details. You can of course create a local copy of an e-mail template with your signature as literal text. But the advantage of using the macro code instead, is that you can change your signature in one place only - without having to change any e-mail templates.
- Note that the codes must be embedded between square brackets.
- Certain codes can be used in certain templates only.
HTML formatting in your e-mail
The code [htmlformatting=1] is used to tell the mail server to use HTML formatted text. It must be at the top of the template. If you want to use plain text instead, then remove this code or change it to [htmlformatting=0]. If you use HTML formatted e-mail then make sure that you use HTML tags for paragraphs (<p></p>), line breaks (<br />) and so on.
Macro code for the e-mail subject line
If the code [mailsubject] is not found then the default for that specific type of e-mail will be used. You can add the [mailsubject] macro to have more control. It must be at the top of the template, underneath the line [htmlformatting=1].
The subject text can be literal text, but it can also contain other macro codes. Below is an example that is used in the activation template (sent to the user with a link to activate his/her account after registering).
[mailsubject=Registration information for [displayname] on [websitename]]
Overriding recipients and/or the sender
By default, the e-mail recipients and the sender e-mail address is automatically set based on what you have configured on the e-mail configuration page. You can override the settings by using codes in specific templates. You may for instance want order notifications to go a different e-mail address than quote requests.
The below codes can be used:
- email must be replaced by the e-mail address that you want to use, e.g. [firstname.lastname@example.org]
- You must make sure that the e-mail address is valid.
- You can use commas in the e-mail address to specify more than one recipient, e.g. [email@example.com,firstname.lastname@example.org]
- Recipient and/or Sender codes must be on their own line. So not more than one code on a line in the template.
- You should only use these codes in the administrative notification e-mails.
Below are a few of the codes that you can use in the templates. This list is not complete.
- [displayname] the user's display name (which can be changed in the user's account properties).
- [websitename] the name of your website as entered in the e-mail configuration.
- [websiteaddress] the address of your website as entered in the e-mail configuration.
- [signature] the full signature as configured, e.g. your website name, phone, contact info and so on.
Other codes can be viewed by editing an e-mail template and such codes are specific for the type of e-mail. For example:
- [activationlink] the url to confirm and activate a new account. Can be used in the activation template only.
- [pv_invnumber] the invoice number when sending an invoice (PDF attachment) to someone.
Custom e-mail template
In version 27.2 or later you can create custom e-mail forms with the code editor. The data that is posted by such forms is parsed by used of the template ceform.txt. Note that this template is used always for such custom forms, the tag [formid] can be used to identify the source. The tag [postedfields] is used to output all form data in the format name=value. Other tags that can be used in this template are:
- [userid] id of the logged in user or 0 if guest
- [username] name of the logged in user
- [useremail] e-mail address of the logged in user
- [userorgname] organisation name of the logged in user
- [userip] ip address
- [useripcountry] country based on the visitor's ip address
If you have problems with changed e-mail templates...
If your changes cause problems i.e. produce unexpected results, then restore the original template by deleting the local version (with your changes) in the list at the bottom of the page.