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:
- Deployed my app in Heroku
- Created a sendgrid account and configured the
username
andpassword
to heroku(to get the sendgrid addon). - added griddler gem and followed the steps mentioned in griddler.
- 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
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 callsunique_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 useapp.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.