Receiving emails with sendgrid and cloudmailin

998 views Asked by At

I have the same concept as mentioned in this question(generating a unique random email address for each user in rails app. When the user sends an email that that randomly generated email address, we process the body and store in db.

I followed the following steps:

  1. Deployed my app in Heroku
  2. Created a sendgrid account and configured the username and password to heroku(to get the sendgrid addon).
  3. added griddler gem and followed the steps mentioned in griddler.
  4. Configured the parse webhook in sendgrid with my host and url.

Here comes the main problem:

I registered to coludmailin and it generated the single email address. I don't really understand how to receive uniq emails to my rails application now. I tried white labeling the cloudmailin.net in sendgrid but it doesn't work(may be am wrong here).

Googled a lot but didn't understand how to proceed from here. Can someone please help me in solving this issue. Appreciate if I get a good step-by-step reference

1

There are 1 answers

1
Steve Smith On

There are two options to do this with CloudMailin.

Option 1:

On the free plan you can use a + in order to separate the email address given to you on CloudMailin and still create a unique email address that each customer can respond to. For example:

If you CloudMailin email address is [email protected] you can use [email protected]. CloudMailin calls unique_id_54321 the disposable part of this email address. This way you can send an email out and state the sender of that email is [email protected] and then tell one user from another.

Option 2 (the better option):

However, the best way to do this is to use CloudMailin's custom domains. You can then receive [email protected].

With custom domains enabled you set CloudMailin up to be your MX server. Then any email coming into yourdomain.com goes direct to CloudMailin (you can use app.yourdomain.com to avoid conflicts with your regular email if needed).

You can then send email out with the sender as [email protected], [email protected] or any other unique identifier. When you receive the email from CloudMailin the envelope will show that the email was sent to [email protected] and you can then use this to resolve who the user was.