computing miniblogs (tverghis)

Local emails when testing your PDS

I was setting up an atproto PDS instance on a VPS to test a CLI tool I'm building, and one of the setup steps in this document asks you to configure an SMTP server. It recommends an email service like Resend or SendGrid.

That might be desirable for a production PDS instance where you want to send emails to actual users. Since I'm only using this instance as a test bed, I didn't want to worry about setting up an account on an email service, verification that I own the domain I'd be sending emails from, or the emails bouncing because I used a fake recipient email address.

I came across MailHog, which was exactly what I needed. A few quick & easy install steps later, I had it up and running, and used the following as the value of the PDS_EMAIL_SMTP_URL configuration:

# in /pds/pds.env
PDS_EMAIL_SMTP_URL=smtp://localhost:1025/

Running MailHog also starts a web UI (by default on port 8025). Since it's also running on my VPS, I can simply port-forward using SSH from my local machine...

$ ssh -L 8025:localhost:8025 user@my.pds.com

... and then navigate to localhost:8025 in my browser to get to the MailHog UI, where I can see all the emails sent by the PDS and received by my test accounts. Nifty!

#atproto #pds