Email Template Coding ​
This topic covers the New Rules for Email Template Coding, added in Student Manager 8.0.097 and newer releases. See the Legacy Template Coding topic for legacy rules.
IMPORTANT:Â you cannot mix legacy and new Email Template coding rules. You must use one or the other for the Email templates.
Template Sections ​
- Email Header -opening text at the beginning of the generated email.
- Email Body - expressions that include information from the data tables. Â The Body is placed between the Header and Footer when the email is generated, and repeated for each course in the registration group.
- Email Footer - closing text at the end of the generated email.
Items you can include in your Email templates:
Text Strings
You may include text strings in all 3 sections of your email template. Â For example:
- Opening messages in your Header (e.g. You have been successfully enrolled in the following:)
- Data labels (e.g. Registrant:, Course:, Location:) in the Body
- Closing messages in your Footer (e.g. contact info, refund policy).
Fields
You may include fields from the Course, Location, Names, NameUDFs, Register and RegUDFs data tables in your Email Body.
Fields must be delimited with the ## delimiter. For example: ##cocrsenm##
IMPORTANT: you must convert numeric and date type fields to character expressions using functions such as Transform(), Str(), or Dtoc(). For example, use the Transform() function to convert the registration fee amount into a character expression:
##transform(rgcrsefee,"99,999.00")##
Email Variables
There are several variables that can be used in the Email Body of registration receipts, mass receipts, and mergmail templates.
Variables must be delimited with the ## delimiter. For example: ##edates##, ##crlf##
Available variables:
- edates  - displays course dates in text format (e.g. March 1 - May 10, 2021)
- edue  - total due for registration in text format (e.g. 25.00)
- emember - displays Membership type and expiration date
- epaid  - total paid for registration in text format (e.g. 25.00)
- eptype  - display payment type (if any)
- ewkshop – displays workshop code and title for all workshops in which individual is enrolled
- eoptfees – displays any Additional Charges assessed to registration
- ebal  - balance due for registration in text format (e.g. 25.00)
- erecpaid - date of payment, receipt number and amount
- epymsg - message stating either ‘Thank you for your payment’, or ‘Balance due X, please make checks payable to institution Y’
- prettyloc – displays formatted location information
- egiftno - displays the Gift Card Number when a Gift Card is purchased.
For text type emails ONLY, you may use the crlf and cr2lf variables to insert line breaks (carriage returns) into your email body.
- crlf - inserts one line break (carriage return)
- cr2lf - inserts two lines line breaks (carriage returns).
Note, line break (carriage return) variables are not required in these new style templates. However, you may want to use them in iif statements to add line breaks (carriage returns) in your data. See the IIF Statements and Line Breaks (Carriage Returns) sections for more information.
Report Functions
You may use report functions that utilizes fields from the Course, Name, NameUDFs, Register, and RegUDFs data tables.
Functions must be delimited with the ## delimiter. For example: ##namer(rgid)##
You may also include functions in your Header and Footer. For example, use the GetMemo() function to include a Memo text record in your Footer:
##GetMemo("RefundPolicy")##
IMPORTANT: you must transform numeric and date type fields to character expressions using functions such as Transform(), Str(), or Dtoc().
For example, if you use the AddCUDFs() function to add a numeric type course UDF to the template, you must use a function like Transform() to convert the numeric value to a character expression:
##transform(addcudfs(rgcrse,"cudfn1"),"999.99")##
IIF Statements
You may use the iif() function in your Email Body to display information only if the condition is true.
For example, use an iif() function to show the Workshop label and workshop information if the registrant is enrolled in workshops for the course.  If this is not a workshop type course--or if the registrant is not enrolled in any workshops, don’t display anything.
##iif(!empty(ewkshop),"Workshops: "+crlf+ewkshop,"")##
Note, your Iif() function statements must be delimited with the ## delimiter.
Line Breaks (Carriage Returns)
You may use line breaks in your Email template. For text type email templates, they will be preserved.
For example:
The line breaks will be preserved in the email:
Tip: check your note fields for trailing line breaks which will also be included in your email. For example, if your Location Information field has trailing line breaks, those will show in the email putting more (possibly unwanted) line breaks in your email.
Line Breaks in HTMLÂ Formatted Emails
You may also use line breaks in HTMLÂ formatted emails, for ease in reading ONLY.
See the HTMLÂ Formatted Emails topic for more information about HTMLÂ formatted emails.
Email Signature
You have a few options to include an Email Signature in your email Footer.
- Hard code the text into your Footer. For example:
- Use the Org Defaults fields. For example:
- Use the Email Signature field from your User record.
- ##EmSig## for text type emails.
- ##EmSigHTML## for HTMLÂ formatted emails.
Example (text type):
- Use the Include my Email Signature option on the Email screen:
This option will include the appropriate email signature from your User record in the email (Email Signature value on text type emails, HTMLÂ Email Signature value on HTMLÂ formatted emails).
Note, if you have the Include my signature (whenever I email) box checked on your User record:
the Include my Email Signature box will be auto-checked for you.
IMPORTANT:Â you cannot use options 1-3 with option 4. That will cause the email to have 2 email signatures.