Modifying the built-in email templates
Raytha sends nine system emails: welcome messages, password notices and one-time login codes. Each is an editable template. This page shows how to change their subject and wording, which variables you can use and how to undo a change.
Before you start
- You need the Manage System Settings permission to see Email templates in the sidebar.
- Raytha must be able to send email. If SMTP is not set up, the emails are never delivered, however good the template is. See Set up SMTP and email and Sending emails.
- Email templates use Liquid, like page templates. Read How Liquid templates work in Raytha first if you have not seen it.
Edit an email template
- In the sidebar, under Design, click Email templates. The list has the columns Subject, Developer name and Updated.
- Click the subject of the template you want. Its developer name is shown under the title.
- In the Envelope card, change the Subject if you want to.
- In the Message body editor, change the HTML and Liquid. Open the side panel to see the variables this template can use, and click one to insert it.
- Click Save at the top of the page.
You should see the notice Email template saved, and a new entry appears in the Revisions panel. The edit applies to the next email sent.
What each template is for
| Developer name | When it is sent |
|---|---|
raytha_email_admin_welcome | You create an administrator and leave Email them a welcome message with a temporary password ticked. |
raytha_email_admin_passwordreset | You reset an administrator's password and tick Email the new password. |
raytha_email_admin_passwordchanged | Someone changes their password using the change password form. |
raytha_email_user_welcome | You create a public user and tick Send welcome email. |
raytha_email_user_passwordreset | You reset a public user's password and tick Email the new password. |
raytha_email_user_passwordchanged | Present and editable, but the current source never sends it. The change password form uses the admin one above. |
raytha_email_login_beginloginwithmagiclink | A visitor asks for a one-time login code. |
raytha_email_login_beginforgotpassword | A visitor submits the forgot password form. |
raytha_email_login_completedforgotpassword | A visitor finishes resetting their password. |
Default subjects all start with [{{ CurrentOrganization.OrganizationName }}], followed by text such as "Website login code" or "Password recovery (link expires after 15 minutes)". The subject is rendered as Liquid too, so you can use variables in it.
Variables you can use
In every email, Target is the person receiving it. CurrentOrganization holds the site settings.
| Variable | Available in |
|---|---|
Target.FirstName, Target.EmailAddress | All nine. |
Target.NewPassword | The welcome and password reset emails. |
Target.LoginUrl | The welcome emails and "completed forgot password". |
Target.LoginWithEmailAndPasswordIsEnabled | The welcome emails. It is false when the site does not allow password sign-in, so the template can leave the password out. |
Target.IsNewlyCreatedUser | The administrator welcome email. It is false when an existing account was added as an administrator. |
Target.ForgotPasswordCompleteUrl | The "begin forgot password" email: the reset link. |
Target.Code, Target.MagicLinkExpiresInSeconds | The one-time login code email. |
CurrentOrganization.OrganizationName, CurrentOrganization.WebsiteUrl | All nine. |
The side panel is the reliable list. Use it rather than this table when in doubt.
An example: add a help line to the login code email
Open raytha_email_login_beginloginwithmagiclink and add a paragraph before the thank-you line:
<p>Need a hand? Reply to this email or visit
<a href="{{ CurrentOrganization.WebsiteUrl }}/contact">our contact page</a>.</p>
Leave the {{ Target.Code }} line in place. Without it the email is useless.
Test your change
There is no "send test email" button. To test, trigger the email for an address you control:
- Make sure SMTP works; see Set up SMTP and email.
- Trigger the email. For the login code, open the site's login page in a private window and request a code. For the welcome and reset emails, create or reset a test account with the email checkbox ticked.
- Open the message and check the subject, the wording and any links.
- If nothing arrives, open Email log under Observability to see what Raytha recorded about the send.
Undo a change
Every save adds a snapshot of the previous version to the Revisions panel. Click Revert beside a revision to restore its subject, CC, BCC and body. Reverting also keeps the version you replaced as a new revision, so you can swap back. See Revisions and publishing.
Gotchas
- CC and BCC do not work on the built-in emails. Raytha refuses CC and BCC on all nine "for security reasons". Leave both fields empty. In the current release, entering any address there is rejected with an "is not in a valid email format" message, even a valid one.
- Do not remove the essential variable. A reset email without
Target.NewPassword, or a code email withoutTarget.Code, sends the person nothing they can use. - Edits are live immediately. There is no draft. Test on a quiet site, or copy the original body into a note before you start.
- You cannot delete or add email templates. The list holds exactly the nine system templates.
- Email clients ignore a lot of CSS. Keep the layout simple, and put styles inline on the element, as the default one-time code email does.
- The subject is required. Saving with an empty subject or body is refused.