In my webapp I have instances where I want to let users send an email to their local representative. But I don't want to expose that user's email so I'd like to have the email sent from [email protected], where a_user_name is different depending on who sends it.
Where I'm lost is how to handle the situation where somebody replies to that email, and I need to deliver it to the original author. I'd like to be able to catch that email, look up the user in our database, and send them an email notifying them of the reply. How do I complete this last part?
Using Rails + Amazon SES
Thanks!
You can integrate with a transactional email provider like Mandrill (or others). There's various mandrill rails gems to help.
See: https://mandrill.zendesk.com/hc/en-us/articles/205583197-Inbound-Email-Processing-Overview
The inbound email gets picked up in a controller like:
You can then parse that email to get the sender validate it against your user table and pass the message on or whatever.
You probably want to set a subdomain of your domain or a totally separate domain so you can route your normal email traffic to your mydomain.com mailservers and pick up the emails to be parsed by rails / processed by the webhook from mail.mydomain.com or whatever.