Documentation
Email

📧 Email Infrastructure

The email.ts file configures transactional email sending capabilities using AWS Simple Email Service (SES) (opens in a new tab). It sets up domain and email identities, adds DNS records for verification, and creates a policy for sending emails.

💡

If you have not bought and set up a custom domain yet, this file will not work. So make sure you buy a domain at Route 53 (opens in a new tab) and set up the appropriate environment variable as described here. Once finished, your emaila account will be in sandbox mode, which means you can only send emails to verified addresses. This file automatically verifies emails to your own domain, which is nice for testing. To be able to send emails to anyone, however, you need to apply for production access here (opens in a new tab)

Let's go through some of the concepts in this file.

Domain and Email Identities

  • SES Domain Identity: This is your domain which will be verified with Amazon SES for email sending. Verifying a domain is necessary to send emails from it and to establish authenticity with email providers, ensuring that your emails are not marked as spam.
  • SES Email Identity: This is a specific email address that will be verified with Amazon SES. It allows you to send emails from this particular address.

Hosted Zone

A hosted zone is a container for DNS records in AWS Route 53 (opens in a new tab). It is needed to manage DNS settings for your domain, including SES verification records. Ensure you have already purchased a domain on Route 53 to use this feature.

DNS Records

MX (Mail Exchanger) Records

MX records specify the mail server responsible for handling emails for the domain. This is necessary for receiving emails (e.g., bounces, complaints) sent to your SES domain.

DKIM (DomainKeys Identified Mail) Records

DKIM is an email authentication method that adds a digital signature to your emails that receiving servers can verify. It helps prevent email spoofing, improves deliverability, and enhances your domain's email sending reputation.

TXT and CNAME Records

These records are necessary for various email-related configurations, such as forwarding emails and integrating with Newsletter services like MailerLite.

💡

Note that you don't need to understand all of the intricacies of this file to use it, but it's good to have a general understanding of what's going on with all these DNS records and custom domains.