Connect includes a subset of the Handlebars HTML template engine. Use these templates to compose more interesting email in HTML.
Our example involves a simple message displaying a list of payees from a Connect table, in a nicely formatted HTML email body.
First, we will create a variable to store the payee data from our table:
1 SQL> set v_payee_list = select first_name, effective_start_date, effective_end_date from xactly.xc_participant;
Now we’ll store our template body in another variable:
1 SQL> set v_template_body = ‘<ul>{{#v_payee_list}} <li>{{first_name}} is effective from {{effective_start_date}} to {{effective_end_date}}</li> {{/v_payee_list}}</ul>’;
Now we create the email object:
1 SQL> create email e_html_template as (“To”=:v_email_to,“BodyType” = ‘html’, “Body”=:v_template_body, “Subject”=‘Email example using Handlebars HTML template’);
And then we send it:
1 SQL> send email e_html_template;
Check your inbox for the formatted HTML email: