Picture of Michael Lee
:wave: Hey hey, I'm Michael Lee and this is my site about being a developer, being a dad and making side projects.
Sponsorship

Avoid setting up an inbox for MailChimp by using AWS's Simple Email Service (SES)

Written on December 1, 2018

MailChimp has become synonymous with email newsletters. Their service is feature rich and provides a generous free tier. It has been my service of choice when I wanted to create a newsletter for a side project. But the one thing about using MailChimp that’s painful, is it’s need for a verified, custom domain, email.

What a custom domain, email is is an email address tied to a custom domain that you own and not a free email like pizzaeatingdude@gmail.com.

Really, I don’t think it’s MailChimp’s fault, or at least all their fault. I think Gmail is also to blame. There once was a time when setting up email for a custom domain with Google was free. Those were the days when getting set up on MailChimp was a breeze and cheap. But gone are the days that Google allows for free email for custom domains and now they charge $5/month for an inbox with added features.

$60 a year may not seem like much but for an indie hacker, that tries to stay nimble and cost effective it is a lot. The other alternative is Zoho, which shined as an alternative when Google phased out their free custom domain applications. I’ve set up a couple of custom domains in the past with them. As generous as the service is and the fact that it gets the job done, it also means it is one more email account to setup and manage.

The solution that I wanted was a place to host a custom domain inbox, so that I can verify the email to use with MailChimp, not have to manage a new inbox and keep costs fairly low.

With this in mind, I thought I’d check with AWS’s Simple Email Service to see if I can utilize it for my needs. And it turns out you can. On a high level you can set up a domain on SES, then you can set up a rule that allows SES to receive emails for a specific email address which acts like an inbox, then you can have this rule dump all messages into an S3 bucket so that you can read the contents of the messages.

You might read this and think, dude this is overkill. It might be, but it fits my needs perfectly. I didn’t want to pay a lot to set up an inbox, I didn’t want to manage another inbox, I wanted to verify my account on MailChimp. An added benefit to using SES is that I’m using a service that I already have an account with, AWS. So it meant one less thing to sign up for.

Avoid setting up an inbox for MailChimp by using AWS’s Simple Email Service (SES)

To get started, I’m going to assume a few things:

  • You’ve got an AWS account
  • You’ve got Simple Email Service setup and out of sandbox
  • You’ve got a custom domain name with a registrar
  • You know how to update your DNS records
  • You’ve got a MailChimp account

Setup your custom domain on SES

In SES, you’ll want to click on Domains listed under the Identity Management heading. Then click on Verify a New Domain.

When the modal for the new domain name pops up, type in the domain name you’d like to verify in the field labeled Domain. You’ll also want to check the option to Generate DKIM Settings. Finally click on the Verify This Domain button.

What proceeds are the various values you’ll need to update for the DNS records of your custom domain. This can be done with the registrar for the domain.

The values given are a TXT record for the actual verification, two CNAME records for setting up DKIM and an MX record for receiving emails to your SES account.

Upon updating the DNS with these records, your domain should now be verified. The DKIM verification may take a little longer.

“Setup your new inbox” or getting your email receiving rule setup in SES

Now that your domain is verified, you can set up a receiving rule for it in SES or what I like to call the faux inbox. What this rule will do is allow for emails to come in for an address you’d like to use and then dump the contents of its messages into an S3 bucket.

Click on the Rule Sets link under Email Receiving heading in SES. Then click on Create Rule. First it’ll ask for a recipient — I used a specific user, but also listed on this page should be examples of how to match addresses in all sorts of variations. Enter the email user you’d like to use for this rule and click on Add Recipient to add them as a recipient. Then click Next Step.

Next, you’ll define an action. I’ve selected the S3 action. In selecting the action, you’ll be given the option to select or create a new S3 bucket to use with this rule. Either select or create a new bucket. I left all other options alone and proceeded to the next step by clicking Next Step.

On the next screen you’ll be asked to give more details for the rule. The options here are definitely changeable and is advised to change later. For now, I’ve found that you’ll have to turn off some things in order for the verification email from MailChimp to arrive successfully.

Fill in the Rule name with something that will help you identify this rule. Then you’ll want to have these options checked:

Enabled                        [x]
Require TLS                    [ ]
Enable spam and virus scanning [ ]

While I suspect that it’s the spam and virus scanning that caused my verification email to bounce from MailChimp, I went ahead and left TLS checked off too, since you’ll be turning them both back on after you’ve verified your MailChimp account.

Now click on Next Step, which will bring you to a review screen and then click Create Rule. With this new rule set up, you’ve essentially got a low cost inbox, all within your AWS account.

Set up MailChimp list

In your MailChimp account, click on Lists in the top nav. Then click on Create List. MailChimp might ask you if you’d rather use tags instead of creating a list, but click on Create List because that’s what we’re really here for :v:

On the next page, you’ll want to fill out the details of the list. In particular, the field that says Default From email address you’ll want to use the same email address we had used to set up the rule in SES. Once you’re done filling out all the details, click on Save.

Now you should have your new list created. But before you can start sending off emails from this list, you’ll need to verify your email address. To verify, go to Settings > List name and defaults in your newly created list.

Scroll down and you should see a section labelled Campaign defaults. Here you’ll see a field similar to the one you saw earlier when creating the list labelled Default From email address now with your email filled in and a little reminder that You must verify you have permissions to send from pizzaeatersunited.com. You can do so by clicking on the link next to the reminder labelled verify domain.

Now, you should see a modal on the screen that explains what the verification process is and the email it will send the verification email to. Click the Send Verification Email.

Immediately a verification email is sent off and you’ll be presented with another modal asking you to Enter verification code from the email it just sent off.

Switch back to your AWS account and go to the S3 bucket that you’ve designated to receive emails from the SES rule. You should now see a file in there that should correspond to the email that MailChimp sent. While the title of the file in S3 will be unrecognizable, the timestamp should be pretty close to the time you have on your system. To read the contents of the file on S3, you can first download it to your local system and then open the file in any text editor.

Scroll down the content of the file and you’ll find the verification code that MailChimp is asking for. Copy it from the email and paste it into the modal field on MailChimp labelled Enter verification code and then click Verify :tada:

Now you should have your MailChimp list ready to go, to start collecting readers and creating relationship and value for those readers.

Secure SES rule

Now that our MailChimp list is verified, we’ll want to go back to the SES rule and turn on the options we had left off — TLS and scanning for viruses and spam.

To do this, go back to AWS and select Simple Email Service, then click on Rule Sets under Email Receiving. Next click on View Active Rule Set. You should see the previously created rule listed. Click on the rule name to open the details of this rule. At the top you should see the options for requiring TLS and enabling spam and virus scanning. So now your rule should be set up like this:

Enabled                        [x]
Require TLS                    [x]
Enable spam and virus scanning [x]

Once you’ve selected the options, click on Save Rule and your rule will now be updated.

Conclusion

Woohoo, now you’ve got a new MailChimp list with a custom domain email set as its from sender. You didn’t have to sign up for another email service just to have another inbox you probably won’t manage. You’re also saving a pretty penny and everything is managed from within your AWS account.

While this solution works for getting a MailChimp list setup, there are definitely additional things that could be setup to make it even better. For example, getting Simple Notification Service setup to email me whenever a new email hits S3. Or setting up a Lambda function to read and then forward the contents of the email to my personal email address that I use on a free Gmail account. For next steps I’ll definitely be picking cloud guru, Kyle Galbraith’s brain, but for now I’m happy with this setup and now I can move onto setting up what I hope will be a great newsletter.

Thanks for taking the time to read this article. I'd love to stay in touch and share more tips on programming and design and side projects. Sign up and I'll send you my articles straight to your email.