How I used Amazon SES with MJML to create email templates in my side-project

How it started

First attempt: mail sending services

Another attempt: Amazon SES

aws ses list-templates
aws ses get-template --template-name simple-template
aws ses create-template --cli-input-json file://simple-template.json
aws ses update-template --cli-input-json file://simple-template.json
aws ses send-templated-email --cli-input-json file://simple-template-single-user.json
aws ses send-bulk-templated-email --cli-input-json file://simple-template-bulk-users.json
{
"Template": {
"TemplateName": "simple-template",
"SubjectPart": "Greetings, {{name}}!",
"HtmlPart": "<h1>Hello {{name}},</h1><p>Your favorite animal is {{favoriteanimal}}.</p>",
"TextPart": "Dear {{name}},\r\nYour favorite animal is {{favoriteanimal}}."
}
}
{
"Source":"WeekHabit Team <week-habit-team@paraboly.com>",
"Template": "mjml",
"ConfigurationSetName": "ConfigSet",
"Destination": {
"ToAddresses": [ "someuser@gmail.com"
]
},
"TemplateData": "{ \"name\":\"Alejandro\", \"favoriteanimal\": \"alligator\" }"
}

Problem

mjml — responsive template framework

./node_modules/.bin/mjml -r simple-template.mjml -o simple-template.html
aws ses update-template --cli-input-json file://simple-template.json

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store