Strict Standards: Declaration of action_plugin_importoldchangelog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /kunden/doogie.de/wiki/lib/plugins/importoldchangelog/action.php on line 8

Strict Standards: Declaration of action_plugin_bloglinks::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /kunden/doogie.de/wiki/lib/plugins/bloglinks/action.php on line 191

Strict Standards: Declaration of action_plugin_tag::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /kunden/doogie.de/wiki/lib/plugins/tag/action.php on line 117

Strict Standards: Declaration of action_plugin_importoldindex::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /kunden/doogie.de/wiki/lib/plugins/importoldindex/action.php on line 57

Strict Standards: Declaration of action_plugin_discussion::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /kunden/doogie.de/wiki/lib/plugins/discussion/action.php on line 1144

Strict Standards: Declaration of action_plugin_feedmod::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /kunden/doogie.de/wiki/lib/plugins/feedmod/action.php on line 133

Strict Standards: Declaration of action_plugin_blockquote::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /kunden/doogie.de/wiki/lib/plugins/blockquote/action.php on line 61

Strict Standards: Declaration of action_plugin_blog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /kunden/doogie.de/wiki/lib/plugins/blog/action.php on line 171

Strict Standards: Declaration of action_plugin_include::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /kunden/doogie.de/wiki/lib/plugins/include/action.php on line 142

Strict Standards: Declaration of action_plugin_openid::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /kunden/doogie.de/wiki/lib/plugins/openid/action.php on line 534

Warning: Cannot modify header information - headers already sent by (output started at /kunden/doogie.de/wiki/lib/plugins/importoldchangelog/action.php:8) in /kunden/doogie.de/wiki/inc/auth.php on line 313

Warning: Cannot modify header information - headers already sent by (output started at /kunden/doogie.de/wiki/lib/plugins/importoldchangelog/action.php:8) in /kunden/doogie.de/wiki/inc/actions.php on line 163
DoogiesWiki [blog:mark_imap_messages_as_read]

Mark IMAP messages as read

I subscribed to some E-Mail Mailinglists, that I do not read very often. Those Mails are automatically sorted into folders on my e-mail provider's IMAP server. In addition to that I want to mark those mails as read immediately.

Therefore I worte this ruby script:

#!/usr/bin/ruby
 
require 'net/imap'
 
server = 'sslmailpool.ispgateway.de'
username = 'yourUsername'
password = '*****'
folder = 'INBOX.Lists.Dokuwiki'
 
imap = Net::IMAP.new(server, 993, true)
Net::IMAP.debug = true
imap.login(username, password)
imap.select(folder)
 
imap.search(["NOT", "SEEN"]).each do |message_id|
  imap.store(message_id, "+FLAGS", [:Seen])
end
 
imap.logout()
# probably not necessary: imap.disconnect()

Mind the dots as seperator betweeen IMAP folders. Took me a while to figre that out.

I saved this script to my debian linux server under /etc/cron.hourly/ so that it runs once every hour.

 
blog/mark_imap_messages_as_read.txt · Zuletzt geändert: 21.01.2010 18:47 von doogie
Recent changes RSS feed Driven by DokuWiki