Live data from Hacker News

Help Needed: Programmatic Email Creation and Management with Custom SMTP Server

news.ycombinator.com

1–10 of 12 posts

Help Needed: Programmatic Email Creation and Management with Custom SMTP Server

#1
Hi HN,

I've been working on a project where I need to programmatically create and manage email addresses under my own domain for each user onboarded. I currently use Resend for sending emails (e.g., welcome emails), and my domain's DNS is managed on Cloudflare. However, Resend doesn't seem to support programmatically creating email addresses.

My goal is to programatically create emails, monitor email and parse them to LLM etc

I've done some research and considered setting up a custom SMTP server to handle this. Has anyone here implemented a similar system? What are the best practices for setting up a custom SMTP server for this purpose? Any recommendations on tools or libraries to make this easier?

I'm looking for advice on the best way forward. Appreciate any insights!

Re: Help Needed: Programmatic Email Creation and Management with Custom SMTP Server

#3
post #2

Do you know about managed SMTP services like AWS SES? Running your own SMTP is possible but would take a lot more work to setup and maintain.

SES sounds like a good option, will look into that. when you say alot more work, could you elaborate on that longer term vs getting the same alternative on a paid provider? Also are there any providers that offer this level of control?

Re: Help Needed: Programmatic Email Creation and Management with Custom SMTP Server

#5
post #2

Do you know about managed SMTP services like AWS SES? Running your own SMTP is possible but would take a lot more work to setup and maintain.

SES sounds like a good option, will look into that. when you say alot more work, could you elaborate on that longer term vs getting the same alternative on a paid provider? Also are there any providers that offer this level of control?

I am running my own SMTP for my SaaS. I used managed SMTP services, including SES, before. It took be roughly 2 months to get it all set up: research the SMTP server options, trial a few of them, pick one, learn it thoroughly, write deployment scripts, deploy it, switch email traffic over to it gradually to warm up the sending IP, and monitor it. Blogged about it here: https://blog.healthchecks.io/2023/08/notes-on-self-hosted-tr...

If you are starting from zero, and are not running in production yet, I suppose it's easier as you can afford to make mistakes and lose some email. I had to measure everything 7 times, and still had one major oh-no event :-)

Re: Help Needed: Programmatic Email Creation and Management with Custom SMTP Server

#10
If you want to implement this yourself just realize that email is a text format. HTTP (2616) is actually based on RFC822 for format. That is important because receiving email requires a full understanding of the routing mechanisms defined in 821 and successive documents. Sending, though, just requires that you get 822 right because sending an email message only requires writing the contents correctly over a socket and DNS. Knowing that is how spammers can blast out millions of emails at almost no cost, because you don’t have to be an email server or client to send emails.
Post reply on HN