lib/chronicle/email/imap_extractor.rb in chronicle-email-0.2.2 vs lib/chronicle/email/imap_extractor.rb in chronicle-email-0.2.3

- old
+ new

@@ -43,16 +43,18 @@ raise(Chronicle::ETL::ExtractionError, "Error connecting to IMAP server. Please check username and password") end def fetch_message_ids keys = gmail_mode? ? search_keys_gmail : search_keys_default - @connection.search(keys) + message_ids = @connection.search(keys) + message_ids = message_ids.first(@config.limit) if @config.limit + message_ids rescue Net::IMAP::BadResponseError => e raise(Chronicle::ETL::ExtractionError, "Error searching IMAP server for messages") end def fetch_message(message_id) - response = @connection.fetch(3100020, "BODY.PEEK[]") + response = @connection.fetch(message_id, "BODY.PEEK[]") raise(Chronicle::ETL::ExtractionError, "Error loading message") unless response return response[0] end \ No newline at end of file