Send Mail
An overview of how to configure your software application to send emails to a single user or list of users.
Last updated
An overview of how to configure your software application to send emails to a single user or list of users.
Last updated
The send email event lets you send an email to a single or multiple email address from within the Dittofi Design Studio. In this article you are going to set up the send email event in four quick steps.
Step 1. create an email template
Step 2. create a send email endpoint
Step 3. create a send email action
Step 4. build and test
(Optional) adding variable information to your email
To start with, we need an email that we want to send out. This could be, for example, an email welcoming users to our app. To do this, head on over to the templates page inside the Dittofi Design Studio. This can be found under the wrench icon.
Next, create a new "Backend" template, in the folder "Views" with the name "Welcome email".
Add some sample HTML to your email. For example:
You can do this from within the endpoints tab. Click +New Endpoint and give your endpoint the name, path, request method and description as shown below.
Your endpoint needs to be configured to receive the To Name, To Email, From Name and From Email. All of this can be done from within the query variable parameters. For example,
Finally, save your endpoint and close it.
Next, head on over to the actions tab and create a new action called "Send email". Link your Send email action to your send email endpoint and add the send email event and configure it as below.
Note:
The subject can either be passed in as a query parameter from your endpoint or, you can grab it from a variable of type text created within the action. In the example above we create the variable within the action and give it the name "Subject"
Right now Dittofi requires that you fill in all the fields for each email, this includes Cc and Bcc. We suggest that you add the to address in both.
The final step is to build your code and test it. To do this, click "Build code" and head back over to your "Send email" endpoint. Press "Run" inside your endpoint and enter in the relevant details.
If you have variable information that you want to include within your email, you can do this by including variable names in your email template. To declare a variable you need to add curly braces like the example below.
Note supports all go template syntax (loops, if statements etc.). For more information on this, read the go docs here https://pkg.go.dev/text/template.
Next, you need to go back to the send email action and add a variable with same exact name and capitalization as the variable in your email template. The contents of this variable will be input into the email template. You can add multiple variables this way.