Skip to content

Triggered Emails

Yaron Tomer edited this page Jan 19, 2016 · 36 revisions

You can have the XMPie system send emails as a response to events that occur on your XMPL webpage. For example, when a person submits a registration form you can trigger an email that will be sent to your site administrator; or you can send a thank you email when someone submits a refer-a-friend form, to thank them for recommending the site to their friend.

To trigger an email to be sent as a result of success in submitting a form, you would use a xmp-success-triggered-email attribute on your XMPL form element (be it xmp-refer,xmp-update or xmp-register form). The same attribute can be placed on your ng-controller element, to send an email on success of loading a page. Use the xmp-clicked-triggered-email attribute on any clickable HTML element, to send an email when the element is clicked.

The following sections explain the attribute values and setup.

Initial Setup

To set up the sending of emails, you must create email touchpoints in your Circle projects. The email touchpoints define email templates that will be sent when triggered. You will use their IDs in the webpage to trigger the sending of personalized emails based on them.

Webpage Setup

Use either of the following email attributes, depending on when you wish to trigger an email to be sent:

  • Add xmp-clicked-triggered-email to an element that when clicked, an email will be sent. The attribute should be set to the email touchpoint that will be triggered. For example:
<button xmp-clicked-triggered-email="E2">I Like! </button>
  • Add xmp-success-triggered-email to either a form element that has the xmp-update, xmp-refer or xmp-register attribute, to trigger an email when the form submit is successfully finished, or to an element with ng-controller of either XMPAnonymousPage or XMPPersonalizedPage, to trigger an email to be sent when successfully loaded. For example:
    <form xmp-update>
          Email: <input type="text" xmp-write-ador="xmp.r.Email"><br/>
          <input class="btn-primary" type="submit" 
                       value="Update" xmp-tracking-action="form submitted" xmp-success-triggered-email="E1">
    </form> 

The value of the attribute should be either one of the following:

  1. A single ID of a touchpoint, for example "E1". This will cause the email identified by this touchpoint ID to be sent.
  2. A comma separated list of touchpoint IDs. This will cause the all emails with the IDs to be sent.
  3. The ID or IDs can be not of touchpoints, but rather of email configurations, which are defined by xmp-email elements. We will discuss this later.

Customizing the Email Touchpoints

In addition to just indicating the email touchpoint that you want to be sent, you can also define other properties of the email, using other attributes on top of xmp-clicked-triggered-email or xmp-success-triggered-email. For example, using the attribute xmp-from on the same node you can determine the from email address of the email. Attributes that you will not define will take their defaults from the touchpoint definition.
The following provides a full list of the attributes that you can use:

  • xmp-subject - email subject
  • xmp-from - from email address
  • xmp-from-name - from display name
  • xmp-reply-to - reply to email address
  • xmp-to - to email address
  • xmp-to-name - to display name
  • xmp-cc - cc email address
  • xmp-cc-name - cc display name
  • xmp-bcc - bcc email address
  • xmp-bcc-name - bcc display name

You can provide values to these attribute that are either constants like [email protected], or expressions that rely on the xmp data structure, like update for {{xmp.recipientID}} successful for xmp-subject, or {{xmp.r["First Name"]}} for xmp-to-name.

Shared Email Configurations

If you are triggering the sending of emails from multiple areas on the page, and would like to share common configurations, you can define xmp-email elements and use their IDs instead of an email touchpoint. You can see an example usage here.

The xmp-email element can have all the customization attributes discussed above. In addition, it MUST have two other attributes:

  • id - The configuration ID. This will be used instead of a touchpoint ID as the value of xmp-success-triggered-email or xmp-clicked-triggered-email to denote that the email should be sent according to this configuration.
  • xmp-touchpoint - touchpoint ID to use for sending emails.

The following is an example definition of xmp-email:

<xmp-email id="update"
       xmp-touchpoint="E4"
	   xmp-subject="update for  {{xmp.recipientID}} successful"
	   xmp-to="admin@xmpie_service.com"
/>

The configuration uses touchpoint E4, and defines customization for the subject of the email and the target email address. It's ID is update. This email is intended to be sent to the site administrator when a new person registers.

Usage for this configuration is defined in the registration form, which can be found here:

 <form xmp-update xmp-success-triggered-email="update" xmp-success-url="index.html">

xmp-success-triggered-email uses update as its value, which means that the sent email will be according to the configuration defined in the email configuration with update id.

Note that you need to use the same attribute to define reference to an email configuration or to a touchpoint ID. First the email configurations are checked for the referred ID. If there is no match, it is assumed that this is a touchpoint ID.

Clone this wiki locally