See it live @ https://roasted.email
Well, temporary emails are not by any chance a new idea. There are a bunch of free services that generate an email for you and let you use the inbox to receive emails for websites you don't want to give your personal one.
So I wanted to build my own essentially to find out how mail servers work, such as postfix or exim. Long story short, the service is live and I still don't know much about postix :( I struggled a bit configuring email forwarding coming from multiple domains. Now the service is live maybe I can have more time to actually find how it works and also use Rails Action Mailbox. This guide seems to be good.
By not using my own mail server, I'm using Sendgrid's Parse API. It's very easy to setup, you just need to add Sendgrid's DNS entries to your domains and set the endpoint URL where Sendgrid POSTs the email and voila! One interesting thing is that Sendgrid doesn't talk in their docs it's requests validation (from what I could find). So one way I added a bit of security to the webhook endpoint is to validate if the IP belongs to Sendgrid. You can find Sendgrid's IP ranges here.
When it comes to the Rails app, it's pretty simple. There's just a handful of models and controllers. I also wanted to use pure Rails without any frontend framework (such as React) and for that UJS was handy.
I also wanted to make it super simple for the user, with just one click he can generate an inbox and it's ready to use.
One suggestion I got from a few friends was to also provide temporary phone numbers. That was an interesting addition to the project and I've described the approach on my blog. Essentially, it's easy to achieve that using Twilio but for Portuguese phone numbers it's too expensive ($15/month to keep a number) and I opted for a custom solution using pre-paid SIM cards. Regarding Twilio, it works very similarly to Sendgrid. When an SMS is received by Twilio, they POST to a Webhook and Rails parses the request.
For now it has been an interesting project. It's not by any chance a complex topic but cool non the least.
Btw, it's open source: https://github.com/andrepcg/roasted-mail
Top comments (0)