Sha256: 600d3fa765c9cdf8d318c860c00593860e9bc9205753b9e06e39aab87f4ca6e9
Contents?: true
Size: 906 Bytes
Versions: 4
Compression:
Stored size: 906 Bytes
Contents
require 'net/imap' module Redimap class ImapConn def initialize @logger = Redimap.logger begin @imap = Net::IMAP.new(Redimap.config.imap_host, { :port => Redimap.config.imap_port, :ssl => true }) @imap.login(Redimap.config.imap_username, Redimap.config.imap_password) rescue Net::IMAP::NoResponseError => e @logger.error { e.to_s } return end if block_given? yield self close end end def close @imap.logout @imap.disconnect end def read_mailbox(mailbox = "INBOX", last_seen_uid = 0) @imap.select(mailbox) uids = @imap.uid_search("#{last_seen_uid + 1}:*") uids.find_all { |uid| uid > last_seen_uid } # IMAP search gets fun with edge cases. end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
redimap-0.5.0 | lib/redimap/imap_conn.rb |
redimap-0.4.0 | lib/redimap/imap_conn.rb |
redimap-0.3.1 | lib/redimap/imap_conn.rb |
redimap-0.3.0 | lib/redimap/imap_conn.rb |