What is the best way to receive email via IMAP protocol in Rails 3?
A:
I am not sure about best, but a simple way is to use Net::IMAP. You can write a rake task and periodically poll the mailbox for emails by using a scheduler like cron.
So your setup would look like this:
- A library file which servers as a wrapper for
IMAPclient and other related operations, like processing the emails. - The
raketask which when called downloads the emails and processes them using the wrapper mentioned above. - The scheduler (Cron or any other of your choice. I personally always prefer
cron) which periodically calls thisraketask.
Swanand
2010-10-04 11:32:16