Wiki

Case Status
Log In

Wiki

 
Email Template Variables
  • RSS Feed

Last modified on 1/18/2012 1:20 AM by User.

Tags:

Email Template Variables

See also: 
   Proper Email Coding Techniques (below)
   CSS Support in Most Common Email Clients - Desktop and Web Based (below)
 

Email Template Variables

Please use a consistent format for the template tags. We need to be consistent so the administration of the templates can be as simple as possible.

NOTE: I currently see two variations of the tags in the 'email_notification_master' table. I see 3 records in the table, two records have tags that are wrapped in [ and ] brackets. While the one has tags that start with $ character. That's not consistent.

I propose using tags similar to the following examples.

Examples:
    [!FIRST_NAME!] 
    [!FULL_NAME!]
    [!ADDRESS1!]
    [!ACTIVITY_NAME!]

My criteria for a good tag:
    1) Speed of mail merge (str_replace, preg_match?)
    2) Easy to see within a lot of html tags -- all caps (easier for admins to manage updates)
    3) Naming convention consistency.
    4) Tag wrapper uniqueness

Some of the cases utilizing the email template system include; 109910351033 and 1032

DEVELOPERS: Below is where you should put the site page or site section, followed by a tag and it's data equivalent -- one per row.

AVAILABLE EMAIL TEMPLATE TAGS
 
Activities (example)
   [!ACTIVITY_NAME!] Name of Activity
   [!RSVP_YES_URL!] URL to RSVP Yes for Activity
   [!ACTIVITY_RECIPIENT!] Name of e-mail recipient.
   [!ACTIVITY_HOST!] Name of host of the activity.
   [!CANCELLATION_MESSAGE!] Message Added by activity host.
   [!ACTIVITY_LOCATION!] Location of the activity.
   [!DAY_OF_WEEK!] Week day of activity start date.
   [!START_TIME!] Activity start time. only start time included please check case #1033
   [!ACTIVITY_DATE!] Activity start date.
   [!POSTER_IMAGE_SRC!] Poster image with Http path
   [!YES!] Activity confirmation URL
   [!NO!] Activity cancellation URL
Send Message system  
   [!RECIPIENT!] Name of e-mail recipient.
   [!MESSAGE!] Message what user write.
   [!LINKTITLE!] Title of link attached
   [!LINKURL!] Url of the link attched
   [!IMG_SRC!] Image  that user select while attaching the URL or uploaded from photo tab

 

AVAILABLE EMAIL Template Notifications    
Database Table: email_templates    
Notification ID (primary key) Notification Name Purpose Variable Used in this template
1 Activity Cancellation email template This template is used when a activity admin cancel an activity, then all member who have register for the activity get the mail using this template that the activity has been cancelled.
  1. [!ACTIVITY_RECIPIENT!]
  2. [!ACTIVITY_NAME!]
  3. [!CANCELLATION_MESSAGE!]
  4. [!POSTER_IMAGE_SRC!]
  5. [!ACTIVITY_NAME!]
  6. [!ACTIVITY_DATE!]
  7. [!ACTIVITY_LOCATION!]
2 Activity Reminder mail for 2-7 days away This template is used when user have selected MAYBE option for an activity and if  the start date is more than 2 days and user wants the system to send reminder to them if the want to confirm or cancel the presence for the activity. This template is used if the reminder need to sent 2 days before the activity start date
  1. [!ACTIVITY_RECIPIENT!]
  2. [!ACTIVITY_NAME!]
  3. [!DAY_OF_WEEK!]
  4. [!START_TIME!]
  5. [!POSTER_IMAGE_SRC!]
  6. [!YES!]
  7. [!NO!]
3 Activity Reminder is set for 1 day away This template is used when user have selected MAYBE option for an activity and if  the start date is more than 2 days and user wants the system to send reminder to them if the want to confirm or cancel the presence for the activity. This template is used if the reminder need to sent 1 day before the activity start date
  1. [!ACTIVITY_RECIPIENT!]
  2. [!ACTIVITY_NAME!]
  3. [!DAY_OF_WEEK!]
  4. [!POSTER_IMAGE_SRC!]
  5. [!YES!]
  6. [!NO!]
4 Send mail with link This template is used when user A want to send a mail to user B  and wants to attach some url i.e  link to some site. Then link title, URL and if thumbnail is selected by user.
  1. [!RECIPIENT!]
  2. [!MESSAGE!]
  3. [!LINKTITLE!]
  4. [!LINKURL!]
  5. [!IMG_SRC!]
5 Send mail with /  without  as attachment This template is used when user A want to send a mail to user B  with or without photo
  1. [!RECIPIENT!]
  2. [!MESSAGE!]

 

 

Files used for sending mails  
Files Path Purpose
PhpMailer ysa_project/ main class and other used in phpmail are available in the folder
phpmail.php ysa_project/system/application/libraries

the file subclass used for sending mail using function send_email with parameter

$to  => Receiver

$sender => sender (default YSACentral)

$subject => subject of the mail

$message => Content of the mail

$bcc => if wnat bcc any one in the mail else optional

$messageText => to support email_body_text

$attachment => optional if  no attachments are available

 

CSS Support in Most Common Email Clients - Desktop and Web Based

Please review the email client and css compatibility matrix Guide to CSS Support in Email. As you are aware, html email must use very simple and what seems to be archaic tags -- we must abide by the guidelines as suggest at the above link. This is to maximize the potential to have consistent looking email across email client platforms.

*** If we design an email that is too complicated, let us know so we can simplify it.
 

Proper Email Coding Techniques

Please make sure all emails have proper Doctype declaired, along with proper 'content-type', proper <head> and <body> tags. With spam filters it is more and more difficult to get emails through the spam filters. It is very important that all email templates are coded properly to make sure they are not immediately discarded due to improper coding.

We are trying to keep emails very minimal so it will be easier to write clean and proper code.

  • Use TABLES and DIV's as necessary
  • Declare a Doctype
  • Include a 'content-type', along with opening and closing HTML, HEAD and BODY tags
  • DO NOT use css 'float' anywhere in the email template
  • Use inline CSS where possible; webmail clients prefer it inline, not declared in the HEAD
  • EMAIL TEMPLATES MUST PASS W3C HTML VALIDATOR

Example Apple Email: