• Introduction
  • Tutorial
  • User guide
  • SDK
  • Examples
  • Creating an email template

    Now we have the Contact Service email service, we need to create our email template, which will define the subject of our email, what content will it contain, where should it be sent to, etc.

    Let’s now go to the Email Templates, where we’ll find one automatically generated sample template. While you can modify the sample template in any way you wish, let’s keep the sample template unchanged and create a new blank one. The name we are giving is Contact Form, and the template ID is contact_form. After the template was created we’ll be redirected to the template editor, where we’ll see the subject field, the content editor and other email fields. Any field can contain dynamic variables, so we can set the value programatically from our Javascript code! To make it easier to identify the different submissions we’ll create a unique subject for each email, that will look something like Contact #4563. We’ll do this by adding a dynamic variable – Contact #{{contact_number}}. We are going to provide the value of the contact_number variable through the EmailJS SDK from our contact form page in next step.

    The content of the template will be pretty simple:
    {{user_name}} ({{user_email}})

    Where the text variable will contain the content of the message. The user_name and user_email are the user’s name and user’s email address, respectively.

    Now we need to fill in the email fields:

    Now let’s save the email template by pressing the Save button. When we are going to the Email Templates page we can see our new Contact Form is present.

    Next step – creating the contact form itself.