Receiving emails with sendgrid and cloudmailin

ε祈祈猫儿з 提交于 2019-12-13 07:10:38

问题


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 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 example1234@cloudmailin.net you can use example1234+unique_id_54321@cloudmailin.net. 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 example1234+unique_id_54321@cloudmailin.net 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 anything@yourdomain.com.

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 user-12345@yourdomain.com, task-12345@yourdomain.com or any other unique identifier. When you receive the email from CloudMailin the envelope will show that the email was sent to user-12345@yourdomain.com and you can then use this to resolve who the user was.



来源:https://stackoverflow.com/questions/35382172/receiving-emails-with-sendgrid-and-cloudmailin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!