Customising password reset emails
Customising the password reset email
From v5.2, it is possible to set up a template HTML file to act as a template for password reset emails.
An example template is available in the folder FBA\Email, and considerations for the template's design are at the end of this article.
To implement:
- Note that during this process the services will restart - users should be out of the system
- Create a new folder on the application server. This is where the custom template will sit, and it should be read accessible by the Windows user account that is used by the WebUI and Service application pools
- Place your custom email template in this folder
- Open App Manager, and select the correct instance
- In the [Config] section, open the [WebUI] tab
- Locate the section <Pentana.Tng.UI.Web.FBA>
- In this section, uncomment the emailTemplatesFolder line
- Replace the value with the path to the template folder
Example: if the file is stored at D:\EmailTemplate\ResetPassword_Template.html, then the line will read:
<add key="emailTemplatesFolder" value="D:\EmailTemplate" />
Optionally, the subject line for the email can be changed by editing the value in the line:
<add key="emailSubject" value="Password Reset" />
- Save the change
- Repeat these config changes in the [FBA] tab and the [Service] tab.
If there is no ResetPassword_Template.html present in the location or it cannot be accessed or read, the default message is sent.
Notes on custom templates
A custom template must:
- Be in the location specified in the config file
- Must be called ResetPassword_Template.html
- Must be HTML file format.
- Contain at least one occurrence of the string %LINK% e.g.
<div>
<a href=”%LINK%”>%LINK%</a>
</div>
The %LINK% will be replaced at runtime with the actual reset password URL.
If it is not present, the fallback email will be used.
Images
Images are supported; however, the physical image file must be located somewhere on the server that can be accessed by the account running the app pool (remembering that the WebUI runs under a separate app pool to that of the service and FBA site) else it will result in a 404 exception and the image not being displayed.
Scripts
Scripts are not supported in this functionality, so to reduce any risk of unwanted behaviour the code will not use any template that contains scripts or links to scripts and will instead use the fallback hardcoded email. The template should just be HTML and CSS.
CSS
This functionality does not support links to external CSS files and if found in the template will result in the default one being used.
The <style> tag is supported, which will provide the ability to add styling to the template. Inline styling of an element is also supported (The default template has examples of this).