-# 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
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
-# redMine - project management software\r
+# Redmine - project management software\r
# Copyright (C) 2006-2008 Jean-Philippe Lang\r
#\r
# This program is free software; you can redistribute it and/or\r
allow_override=ATTRS allow email content to override attributes\r
specified by previous options\r
ATTRS is a comma separated list of attributes\r
+ \r
+Processed emails control options:\r
+ move_on_success=MAILBOX move emails that were successfully received\r
+ to MAILBOX instead of deleting them\r
+ move_on_failure=MAILBOX move emails that were ignored to MAILBOX\r
\r
Examples:\r
# No project specified. Emails MUST contain the 'Project' keyword:\r
:ssl => ENV['ssl'],\r
:username => ENV['username'],\r
:password => ENV['password'],\r
- :folder => ENV['folder']}\r
+ :folder => ENV['folder'],\r
+ :move_on_success => ENV['move_on_success'],\r
+ :move_on_failure => ENV['move_on_failure']}\r
\r
options = { :issue => {} }\r
%w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] }\r