Browse files

Added the ability to specify the IMAP folder to be processed.

  • Loading branch information...
1 parent 7ebbaa8 commit f480cc54e61c194fd6bc758fb67fc4b686cb03c7 @johnhampton johnhampton committed with May 3, 2009
Showing with 3 additions and 1 deletion.
  1. +1 −0 README.rdoc
  2. +2 −1 lib/fetcher/imap.rb
@@ -43,6 +43,7 @@ The following options can be passed to the <tt>Fetcher.create</tt> factory metho
[<tt>authentication</tt>] The authentication scheme to use (IMAP only). Supports LOGIN, CRAM-MD5, and PASSWORD (defaults to PLAIN)
[<tt>use_login</tt>] Set to any value to use the LOGIN command instead of AUTHENTICATE. Some servers, like GMail, do not support AUTHENTICATE (IMAP only).
[<tt>sleep_time</tt>] The number of seconds to sleep between fetches (defaults to 60 seconds; valid only for the generated daemon)
+[<tt>in_folder</tt>] The name of the folder from which to read incoming mail (IMAP only). Defaults to +INBOX+.
[<tt>processed_folder</tt>] The name of a folder to move mail to after it has been processed (IMAP only). <b>NOTE:</b> If not specified, mail is deleted.
[<tt>error_folder</tt>] The name a folder to move mail that causes an error during processing (IMAP only). Defaults to +bogus+.
@@ -20,6 +20,7 @@ def initialize(options={})
@port = options.delete(:port) || PORT
@ssl = options.delete(:ssl)
@use_login = options.delete(:use_login)
+ @in_folder = options.delete(:in_folder) || 'INBOX'
@processed_folder = options.delete(:processed_folder)
@error_folder = options.delete(:error_folder) || 'bogus'
@@ -42,7 +43,7 @@ def establish_connection
# Retrieve messages from server
def get_messages
@connection.uid_search(['ALL']).each do |uid|
msg = @connection.uid_fetch(uid,'RFC822').first.attr['RFC822']

0 comments on commit f480cc5

Please sign in to comment.