diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-12-31 14:56:30 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-12-31 14:56:30 +0000 |
commit | 16eb0421e5acbddcb3fa4ed18326b73bf6901482 (patch) | |
tree | 6cb5990d870a67620d4b87f4ed95c883530a1a19 /lib/redmine/imap.rb | |
parent | 538bd7cd7fa880b35ce7f28d86a9b583a494fb46 (diff) | |
download | redmine-16eb0421e5acbddcb3fa4ed18326b73bf6901482.tar.gz redmine-16eb0421e5acbddcb3fa4ed18326b73bf6901482.zip |
IMAP: add options to move received emails.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2220 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/imap.rb')
-rw-r--r-- | lib/redmine/imap.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/redmine/imap.rb b/lib/redmine/imap.rb index a6cd958cd..383d82f23 100644 --- a/lib/redmine/imap.rb +++ b/lib/redmine/imap.rb @@ -1,4 +1,4 @@ -# redMine - project management software +# Redmine - project management software # Copyright (C) 2006-2008 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or @@ -33,9 +33,18 @@ module Redmine msg = imap.fetch(message_id,'RFC822')[0].attr['RFC822'] logger.debug "Receiving message #{message_id}" if logger && logger.debug? if MailHandler.receive(msg, options) + logger.debug "Message #{message_id} successfully received" if logger && logger.debug? + if imap_options[:move_on_success] + imap.copy(message_id, imap_options[:move_on_success]) + end imap.store(message_id, "+FLAGS", [:Seen, :Deleted]) else + logger.debug "Message #{message_id} can not be processed" if logger && logger.debug? imap.store(message_id, "+FLAGS", [:Seen]) + if imap_options[:move_on_failure] + imap.copy(message_id, imap_options[:move_on_failure]) + imap.store(message_id, "+FLAGS", [:Deleted]) + end end end imap.expunge |