Skip to content

Email Template Coding (Legacy Templates) ​

This topic covers the Legacy Email Template Coding. See the Template Coding (.97 and later) for newer --and easier-- body coding rules.

IMPORTANT: you cannot mix legacy and new body coding rules. You must use one or the other for the Email Body.

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 within the sections of your email.  For example:

Header: You have been successfully enrolled in the following:

Body: "Student Name: ", "Dates: ", "Time: "

Footer: Thanks for your interest in our program. If you have any questions, please contact us.

IMPORTANT NOTES:

  • If you are NOT using fields and functions in the Header and Footer, you can use plain text (no quotes).
  • If you use fields and functions in the Header and Footer, you MUST enclose the text in quotation marks "".
  • In the Body, Text strings MUST ALWAYS be enclosed in quotation marks "".
  • For HTML formatted emails, HTML is treated as text and must be enclosed in quotes.
Concatenation Marks (+)

The plus sign (+) Concatenation Mark is used to join the pieces of your email together when using fields and functions.

Email Body: you MUST put a plus sign (+) between each item in your email body. For example:

"Student Name: "+namer(rgid)+crlf+"Course:"+cocrsenm

Email Header and Footer: if you are using fields and functions in your header and footer, you must put the plus sign (+) between each item. For example:

"Thanks for your interest in our program. If you have any questions, please contact us. "+cr2lf+xc_orgtitle+crlf+xc_phone+crlf+xc+url

Fields

You may include fields from the Course, Location, Names, NameUDFs, Register and RegUDFs data tables in your Email Body.

Fields are not text and must not be enclosed in quotes "".

IMPORTANT: you must transform 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

The following is a list of variables that can be used in the email body of registration receipts, mass receipts, and mergmail templates:

  • 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).

IMPORTANT: if you are using HTML formatting in your email, you cannot use the carriage return variables to insert line breaks. You must use the <br> tag to insert line breaks.

Report Functions

You can use any report function that utilizes fields from the Course, Name, and Register databases. For example:

namer(rgid), transform(rgcrsefee,"99,999.00")

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,"")

Line Breaks in the Body

In Legacy templates, your Email Body cannot contain any line breaks. E.g. line breaks in this example will break the email routine:

It should be one long string without line breaks, e.g.:

Email Signature

You have a few options to include an Email Signature in your email Footer.

  1. Hard code the text into your Footer. For example:

  1. Use the Org Defaults fields Data Structures > Organization Defaults. For example:

  1. Use the Email Signature field from your User record.

Example (text type):

  1. 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.