module SearchMbox

Constants

VERSION

Public Class Methods

delete_all() click to toggle source
# File lib/search_mbox.rb, line 49
def self.delete_all
    @imap.select('INBOX')
    @imap.search(['ALL']).each do |msg_id|
        @imap.store(msg_id, "+FLAGS", [:Deleted])
    end
    @imap.expunge
end
login(host, account, passwd, port = 143, imap_usessl = false) click to toggle source
# File lib/search_mbox.rb, line 6
def self.login(host, account, passwd, port = 143, imap_usessl = false)
    @date_attr_name = 'INTERNALDATE'
    @envelope_attr_name = 'ENVELOPE'
    @subject_attr_name = 'BODY[HEADER.FIELDS (SUBJECT)]'
    @body_attr_name = 'BODY[TEXT]'
    @imap_port = port
    @imap_usessl = imap_usessl
    begin
        @imap = Net::IMAP.new(host, @imap_port, @imap_usessl)
        @imap.login(account, passwd)
    rescue => e
        STDERR.puts "[ERROR] #{e}"
        exit 1
    end
end
logout() click to toggle source
# File lib/search_mbox.rb, line 57
def self.logout
    @imap.logout
end