Name
Net::IMAP — IMAP access class
Synopsis
Net::IMAP is a class
for Internet Message Access Protocol Version 4 (IMAP4) client-side
connection. IMAP4 allows you to store and manage messages in the
server side.
Required Library
require “net/imap”
Example
require "net/imap"
imap = Net::IMAP::new("imap.ruby-lang.org")
imap.login("matz", "skwkgjv;")
imap.select("inbox")
fetch_result = imap.fetch(1..-1, "UID")
search_result = imap.search(["BODY", "hello"])
imap.disconnectClass Methods
Net::IMAP::add_authenticator(auth_type,authenticator)Adds an authenticator for
Net::IMAP#authenticate.Net::IMAP::debugReturns
trueif in the debug mode.Net::IMAP::debug=boolSets the debug mode.
Net::IMAP::new(host[,port=143])Creates a new
Net::IMAPobject and connects it to the specifiedporton the namedhost.
Instance Methods
-
imap.append(mailbox,message[,flags[,date_time]]) Appends the
messageto the end of themailbox.imap.append("inbox", <<EOF.gsub(/\n/, "\r\n"), [:Seen], Time.now) Subject: hello From: shugo@ruby-lang.org To: shugo@ruby-lang.org hello world EOFimap.authenticate(auth_type,arg...)Authenticates the client. The
auth_typeparameter is a string that represents the authentication mechanism to be used. CurrentlyNet::IMAPsupports"LOGIN"and"CRAM-MD5"for theauth_type.imap.authenticate('CRAM-MD5", "matz", "crampass")imap.capabilityReturns an array of capabilities that the server supports.
imap.capability # => ["IMAP4", "IMAP4REV1", "NAMESPACE", ...]
imap.checkRequests a checkpoint ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access