Receiving emails in your app
There are some methods to acomplish this task, amongs other there is a popular one that is described in railsquides
But I was looking for something, that is more generic and less coupled with my app, and the only responsibility is receiving emails and sending them through http to the app.
After some research I’ve found 2 gems, that were a great match for this job:
First thing that you need to do is setup an email account where users are going to send emails. The simplest way is to start with gmail, and if there’s goinng to be more than one email address in context of your domain, then setup google app for it.
This gist is almost whole implementation of email client, that every 10s checks inbox, and if there is anything new, then sends it to endpoint (app).
On production server of course you need to use god or monit to be sure that it runs without any problems. “god” will help you to demonize it. If you expect a lot of email traffic, then you also need to think of some queue, like resque.
In your app you just need a controller with create action.
You also have to implement some kind of authentication mechanism, to make sure that your app gets emails from known source.