Back
Question
Asked

How do you test your emails before sending them?



I send the test email to www.mail-tester.com/ and use self hosted Kutt link shortner for any links that are considered “broken/spammy”. For example almost any link to medium.com articles are considered spam. I have no idea why

After verifying them locally etc, I follow this multiphase approach when introducing new email-sending functionality in production:

  1. Send every email to myself instead of user
  2. Send to user, and BCC myself
  3. Send only to user, remove my BCC

This lets me safely test the emails go out to the right people at the right time in the right format. I wait a few days or sometimes weeks between each phase.

I have the exact same strategy for #jomo , BCC'ed myself for a few days for all new email templates.
I still BCC myself for emails related to some features like student discounts, this way I know the pipeline for that feature is working from A to Z. This serves more as a "health check" in that situation.

I write the html and preview it in my ide.

then I send it to my self via the app I'm building

if it looks good I ship

I use mailtrap.io such an excellent tool

just looked at them, that's what I was looking for, and someone made a saas from it, nice

I use a docker image called maildev - it simulates a SMTP server and I can view all sent emails locally in a web UI to make sure the format looks visually OK

EDIT: Here's the docker-compose.yml file I use for development on most of my apps. Make sure to leave the MAILDEV_IP environment variable as it is there, it's important to make sure the healthcheck runs properly:

services:
  db:
    image: postgres:16.3
    restart: always
    environment:
      - POSTGRES_DB=unblock_domains
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=password
    ports:
      - 5432:5432
  smtp:
    image: maildev/maildev:2.1.0
    restart: always
    environment:
      - MAILDEV_INCOMING_USER=smtp
      - MAILDEV_INCOMING_PASS=password
      - "MAILDEV_IP=::"
    ports:
      - 1080:1080
      - 1025:1025

In terms of validating that emails will be sent at the right time to the right person - this is where automated tests are super useful.

Then I just let it rip!

ah I like this one, I'll definitely give it a try, cause I was just looking for something to give me a sense of how it looks visually before I send it. Thanks man

Email Service Provider (ESP) normally have a "send test email" option.

Or when I worked in team setup, my teammates will send a test email to our emails first, and ask us to check if it's a GO or NO GO.

I used loops.so for both marketing/newsletter and transactional emails.

For transaction email:
- I do test by local, and then production but send to me
- I send to user but BCC to me
- Finally, I remove BCC code because it sends too many mail to me :)))

For marketing mail: I use Resend