Receiving emails?

I’m trying to write a mailer daemon of sorts. Here, I’m trying to look
through every email received in some inbox by searching through the
message
body for a certain keyword. If the keyword was mentioned, an appropriate
response is sent.

The action mailer
guidehttp://guides.rubyonrails.org/action_mailer_basics.html#receiving-emailsis
quite useful:

"1. Implement a receive method in our mailer.

  1. Configure your email server to forward emails from the address(es)
    you
    would like your app to receive to /path/to/app/script/runner
    ‘UserMailer.receive(STDIN.read)’."

But I’m not sure how to do the second part: the email I’m dealing with
is a
Gmail account. How does this work?

Thanks,

Sid

On Aug 17, 4:13 pm, Siddarth Chandrasekaran
[email protected] wrote:

  1. Configure your email server to forward emails from the address(es) you
    would like your app to receive to /path/to/app/script/runner
    ‘UserMailer.receive(STDIN.read)’."

But I’m not sure how to do the second part: the email I’m dealing with is a
Gmail account. How does this work?

Thanks,

Sid

It doesn’t work… the guide is assuming that 1) you have control of
the mail server and 2) the mail server and your app reside on the same
machine (at least this is my understaning, please correct me if
wrong). The easiest way I know of to do this is to write a daemon that
periodically uses IMAP to search for messages of the given criteria.
IMAP can be more than a bit tricky though, but definitely ask when you
run into stumbling blocks. (I’ve yet to find an IMAP gem that I
dislike little enough to actually use :\ but the source for sup is a
good place to get an understanding of how Net::IMAP works)