Basics: Transactional Mail

Transactional emails, sometimes called "triggered" mail, are used to send an individual, or a small group of individuals, a notification. Some examples of common transactional mails on websites:

  • Welcome emails
  • Password resets
  • Verification emails
  • Receipts for checkouts
  • Reminders
  • Newsletter double-optin requests
  • Alerts
  • Bug reports

Many traditional web apps use their own SMTP servers and templates maintained in the code repository. This is often inflexible and poor for delivery.

Sailthru makes it easy to maintain and set up these kinds of emails via "templates."

Setting up your Templates

The Templates link in the main menu provides an interface where you can manage your transactional templates. Each template has a case-sensitive name which you will use to refer to it later.

  • Fill out the Basics tab. The main fields you should fill out are Template Name, From Name, and Subject.
  • Design the look of your template in the Code and/or Text Version tabs. You must fill out at least one of these tabs, and Code (HTML email) is recommended, but you can send text emails if you wish.
  • Test your template by entering your email address in the Test Send box and clicking the button.

Replacement Variables

Obviously, you won't want to send the exact same email every time, so you can personalize the email with replacement variables, or vars for short. Replacement vars are case-sensitive and denoted with {curly_braces}.

<p>Dear {name},</p>

<p>Welcome to Example.com! Your username is <b>{username}</b>.

For the most part, you can use any replacement variables you want, but you should stay away from a few reserved words listed at the bottom of this page.

Replacement vars can be used in the From Name, Subject, Code and Text Version fields.

Most of the time, you only need replacement vars. Sailthru also has a much more powerful syntax with control structures like {if} and {foreach} – see syntax for more on that.

Sending the Transactional Email

You can do this from your code with the send API call. There are a number of options that are documented in the send call, but at a basic level you can use one of our client libraries to send in as little as a single line of code:

$sailthru->send('my_template', 'example@example.com', array('var_1' => 'Value A'));
sailthru.send('my_template', 'example@example.com', { 'var_1' => 'Value A' } )
 
/var/www/docs.sailthru.com/htdocs/data/pages/transactional.txt · Last modified: 2011/10/27 16:36 by Emily Maskin
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki