How to use AWS SES email templates - Guide
Table of contents
- Creating AWS IAM user
- Configuring Sovy account
- Verifying AWS SES email identity
- Creating first AWS SES email template
- Sending first email using a template
- Leaving sandbox (optional)
If you are here not by accident, you probably have one of these 2 problems:
- You want to use AWS SES email templates but you don't know how.
- You already use AWS SES email templates and you're looking for a better way to deal with them.
After you read this post, you will know everything you need. So now, let's focus for just a few more minutes and get right into it!
Creating AWS IAM user
First, you need to create an IAM user for Sovy - the template manager - so it will have access to actually manage your templates, identities, and other SES settings. Enter "IAM" into the searcher at the top of the AWS console and click the IAM service. It will take you to the IAM dashboard.
In the left-side navigation bar, you will find a link Users - click it! Now, you may already have a few users on the list but it is a good practice to have a separate user for each external service that needs access to your AWS, so we will create a new one. There is a blue button Add user above the table. Let's click it.
The full process of creating an IAM User is divided into 5 parts - each one of them is super short and easy to complete.
On the first screen, we need to enter the user's name and select the Access Key - Programmatic access option. By selecting it we specify that we want to generate a set of keys for our user that is required e.g. to talk to AWS API. This is what Sovy - our template manager - needs.
The other option - Password - AWS Management Console access - is for users that will need access to the AWS console (the same console you're in right now). After we're done here click the button saying Next: Permissions.
The next step allows us to set permissions for our user, which in our case is the template manager. It requires full access to AWS SES service to fully manage your templates, display important information about your account, some statistics, etc.
Start with clicking the Attach existing policies directly button. Then, enter "SES" in the searcher inside the table below. After the table filters its records, find the policy called AmazonSESFullAccess and select the checkbox next to it. We're ready to move to the next step.
The third step allows you to add some tags to your user. Tags are always optional in AWS and you can use them to organize your resources if you want. You can also just leave those fields empty and move on to the review.
In this step, you can make sure the configuration for the new user is correct and accept it by clicking the Create user button.
Congratulations, the IAM User for the template manager is ready. Now, copy both Access key ID and Secret access key and save them locally, somewhere in your notes, just for a while. We're gonna need them to configure your Sovy account.
Remember - you should not share these credentials with anyone else. After you configure your Sovy account, you can remove them from your notes. You shouldn't need them ever again.
Configuring Sovy account
Finally, we get to the fun part! We're about to create an account on Sovy and configure access to our AWS account using the IAM User credentials we just generated. Start by visiting the Sovy home page - https://sovy.app - and clicking the blue button Get Started in the top right corner. It will take you to the sign up/sign in page, where you can authenticate using your Google account.
Once you're in, you will land on the onboarding screen, where you will be asked for the AWS account settings. Here you should enter the credentials of the IAM User we created earlier and select the AWS region that you're using. Click Save settings once you set everything up.
Verifying AWS SES email identity
If you haven't verified any email identities before, we will help you verify one now. You will need it for 2 reasons:
- Addresses that you want to use as "From", "Source", "Sender", or "Return-Path" need to be verified.
- If your Amazon SES account is still in the sandbox, you also need to verify any email addresses to which you plan on sending emails.
To verify an email address as an email identity you just need to enter it in the empty field, submit the form, and click a verification link that you will find in an email that will be sent to it to prove that you own it.
And don't worry - you can add more later, inside the Sovy's dashboard.
If everything went well you should now see a screen like this. If you already added any templates to your AWS SES account before, you should see them on the template list.
Now you're ready to create your first email template with Sovy.
Creating the first AWS SES email template
First, click the Create template button to open the dialog asking you to pick the editor type.
- Code editor - full control, requires knowing HTML and CSS
- Visual editor - drag and drop, easy to use, powerful editor
I will choose the code editor because I already have the HTML email template that I want to use. After clicking the Code editor button you will see the page with a template form.
The form itself is very simple, yet gives you full control over your template. You can set up:
- Template name
- Email subject
- Email HTML content
- Email text content
When you're editing the HTML content, you can use a special editor mode that expands the code editor and the preview to full screen, which makes editing your template even better.
After you're done editing your template just click the Save template button. That's it, we just created an Amazon SES email template that we can now use to send emails!
Sending the first email using a template
I know that Amazon provides SDKs for many programming languages, but I'm going to use only TypeScript as an example. It shouldn't be very difficult to translate this into other languages.
Leaving sandbox (optional)
If you just started using Amazon SES, your account will be in Sandbox mode. This mode limits you with a small sending quota, but what's more important, it lets you send emails only to email addresses that are verified as email identities.
To leave the Sandbox mode, you can click the Leave Sandbox button that is placed inside the Account Status section. It will show you a simple form that you need to complete.
The most important is the Use case description field. We prefilled it with some placeholder text to give you an idea how should it look like. You should change it so it precisely describes your email-sending processes and procedures, like how often you send emails, how you maintain your recipient lists, and how you manage bounces, complaints, and unsubscribe requests.
After you send the form, you usually need to wait a few hours, up to a few days, for AWS to reply. They will either accept your request and upgrade your account or ask for some more details.
Well done! Now you know how to deal with SES email templates and have all the tooling you need. If you think something is missing from this guide or something is not clear, please let me know at firstname.lastname@example.org.