Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Processing incoming emails on Heroku

For my side project kwiqi, I use ActionMailer's 'receive' method to process incoming email messages for tracking my expenses. Heroku doesn't have a local mail server running that same code will not work. One solution I've thought of is to periodically hit a controller action that will pull messages from Gmail. Are there other solutions that are reasonable? Is anyone processing incoming emails in Heroku?

like image 446
Jerry Cheung Avatar asked Jan 21 '10 03:01

Jerry Cheung


4 Answers

You can use sendgrid addon, and their parse api (http://wiki.sendgrid.com/doku.php?id=parse_api). I've written a short tutorial on how to do so here: http://nanceskitchen.com/2010/02/21/accept-incoming-emails-into-a-heroku-app-using-sendgrid/

like image 134
DougB Avatar answered Oct 11 '22 10:10

DougB


I know that this is a little late but for anyone else that might find this useful in future we created the http:///CloudMailin.com addon for Heroku that should help you to receive email on Heroku Rails apps really easily.

like image 37
Steve Smith Avatar answered Oct 11 '22 08:10

Steve Smith


Heroku support running workers using DelayedJob. Workers are resourced just like Dynos (you pay by the hour) and for this you get a dedicated resource to process your emails.

In the past I have used Cron calling a controller in my app. It's pretty effective.

If the hourly limitation is an issue, you can call your app from another location ... I have a cheap Dreamhost account for some of my non-priority sites that I have used as Cron systems.

There are also a number of ping and uptime services that you can use for this purpose as well ... simply pass these services your email controller.

like image 31
Toby Hede Avatar answered Oct 11 '22 09:10

Toby Hede


A real limitation of Heroku currently is that the most rapid frequency they support for cron jobs is hourly.

I'd recommend using Gmail and using delayed job as an alternative to cron to set a more reasonable frequency. There is a good tutorial on setting this up at WiseJive

like image 33
Mike Buckbee Avatar answered Oct 11 '22 09:10

Mike Buckbee