AWS Simple Email Service (SES) to send emails with Golang

Setting Up

  1. Install the AWS CLI, I will be using version 2.
  2. Log into AWS console and head over to AWS SES and verify your email to in order for you to receive emails. For you to send emails without needing to verify you would need to contact AWS to lift that restriction from you.

Creating Template

Below is a sample template (sample.json)

Create template

Sending Email With Golang

sendEmail is a simple function that takes in the data, template name and the recipient.

Sending the sample email

The only tricky part might be the data variable, this is just a string formatted as JSON (I don’t like doing that myself so if anyone knows a better way please let me know). The fields are the variables surrounded by curly braces ({{VARIABLE}}) inside the template. This will replace those and when you send the email it will look like so.

Thank you for stopping by, I hope you learning a little about AWS SES. If you would like me to write about a different service please let me know.

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