News for hackers. Stuff that matters.

Show HN: Mailrecipe limits the number of emails you send to a user to 1 per day

Last week, I spammed my users with emails by mistake. I had written an idempotent method to do a transaction and send a confirmation email. I didn't realize the email call is not idempotent. So, when the transaction failed, it retried again and again and spammed the entire user base with emails. I was so embarrassed and wrote an API layer on top of my email delivery service (SendGrid) to ensure that my users won't get more than 1 email per day, irrespective of my architecture or mistakes. I am publishing it as a public API, in case anyone else needs it:

https://rapidapi.com/mailrecipe/api/mailrecipe

Have you run into this problem? How did you solve it?

( 2 comments | 6 points | on HN )
Re:Show HN: Mailrecipe limits the number of emails you send ... by santypk4 on Tuesday February 19, 2019 @09:08PM (#19204981)
Wow! I have to check this out. This is a common mistake, especially when you don’t know what the system does if you are new or if you are testing, last week I receive 100 emails from my ex-companye, a new employer run a script on some old staging database, 10.000 emails were sent.
Re:Show HN: Mailrecipe limits the number of emails you send ... by QueensGambit on Thursday February 21, 2019 @03:10PM (#19220134)
Thanks! Yes. That's a common mistake too. Like security, people understand the magnitude of this problem after the fact. All it takes is a dry run or try/catch block by a new member in the team :)