Sha256: e1c02af35d6dabced591d03eb0493f7b59258cf36a05175ae99bce176460d0fa
Contents?: true
Size: 1006 Bytes
Versions: 2
Compression:
Stored size: 1006 Bytes
Contents
#!/usr/bin/env ruby require 'imap_guard' SETTINGS = { host: 'imap.googlemail.com', port: 993, username: 'you@gmail.com', password: 'your_pass', } settings = SETTINGS.merge({ read_only: false }) base_query = ImapGuard::Query.new.unflagged.unanswered.freeze guard = ImapGuard::Guard.new settings # guard.debug = ->(mail) { print "#{mail.subject}: " } guard.login guard.select 'INBOX' # Github %w(github.com notifications@travis-ci.org app@gemnasium.com).map do |from| base_query.dup.from(from) end.each do |query| guard.move query, 'INBOX.Github' end # To Do guard.move base_query.dup.from("me").to("me"), 'INBOX.TODO' # Ops guard.select 'INBOX.Ops' query = base_query.dup.seen guard.delete query.dup.subject("monit alert -- ").before(7) guard.delete query.dup.subject("CRON-APT completed on ").before(3) guard.delete query.dup.subject("Logwatch for ").before(7) guard.select 'INBOX' # Uni guard.move base_query.dup.or.from("uni.tld").to("uni.tld"), 'INBOX.Uni' # Bye! guard.disconnect
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
imap_guard-1.0.0 | examples/example.rb |
imap_guard-0.0.4 | examples/example.rb |