IMAP: Mark emails as Seen.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1571 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
268165a013
commit
8b33565b3e
|
@ -30,14 +30,22 @@ module Redmine
|
||||||
imap.login(imap_options[:username], imap_options[:password]) unless imap_options[:username].nil?
|
imap.login(imap_options[:username], imap_options[:password]) unless imap_options[:username].nil?
|
||||||
imap.select(folder)
|
imap.select(folder)
|
||||||
imap.search(['ALL']).each do |message_id|
|
imap.search(['ALL']).each do |message_id|
|
||||||
puts "Receiving message #{message_id}"
|
|
||||||
msg = imap.fetch(message_id,'RFC822')[0].attr['RFC822']
|
msg = imap.fetch(message_id,'RFC822')[0].attr['RFC822']
|
||||||
|
logger.debug "Receiving message #{message_id}" if logger && logger.debug?
|
||||||
if MailHandler.receive(msg, options)
|
if MailHandler.receive(msg, options)
|
||||||
imap.store(message_id, "+FLAGS", [:Deleted])
|
imap.store(message_id, "+FLAGS", [:Seen, :Deleted])
|
||||||
|
else
|
||||||
|
imap.store(message_id, "+FLAGS", [:Seen])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
imap.expunge
|
imap.expunge
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def logger
|
||||||
|
RAILS_DEFAULT_LOGGER
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue