Get the URI
of the remote object.
Get the URI
of the remote object.
Wakes up all threads waiting for this lock.
Puts the connection into binary (image) mode, issues the given command, and fetches the data returned, passing it to the associated block in chunks of blocksize
characters. Note that cmd
is a server command (such as “RETR myfile”).
Puts the connection into ASCII (text) mode, issues the given command, and passes the resulting data, one line at a time, to the associated block. If no block is given, prints the lines. Note that cmd
is a server command (such as “RETR myfile”).
Puts the connection into binary (image) mode, issues the given server-side command (such as “STOR myfile”), and sends the contents of the file named file
to the server. If the optional block is given, it also passes it the data, in chunks of blocksize
characters.
Puts the connection into ASCII (text) mode, issues the given server-side command (such as “STOR myfile”), and sends the contents of the file named file
to the server, one line at a time. If the optional block is given, it also passes it the lines.
Returns an array of filenames in the remote directory.
Returns an array of file information in the directory (the output is like ‘ls -l`). If a block is given, it iterates through the listing.
Returns data (e.g., size, last modification time, entry type, etc.) about the file or directory specified by pathname
. If pathname
is omitted, the current directory is assumed.
Returns system information.
Returns the status (STAT command). pathname - when stat is invoked with pathname as a parameter it acts like
list but alot faster and over the same tcp session.
Sends a STARTTLS command to start TLS session.
Sends a SUBSCRIBE command to add the specified mailbox
name to the server’s set of “active” or “subscribed” mailboxes as returned by lsub()
.
A Net::IMAP::NoResponseError
is raised if mailbox
cannot be subscribed to; for instance, because it does not exist.
Sends a UNSUBSCRIBE command to remove the specified mailbox
name from the server’s set of “active” or “subscribed” mailboxes.
A Net::IMAP::NoResponseError
is raised if mailbox
cannot be unsubscribed from; for instance, because the client is not currently subscribed to it.
Sends a LIST command, and returns a subset of names from the complete set of all names available to the client. refname
provides a context (for instance, a base directory in a directory-based mailbox hierarchy). mailbox
specifies a mailbox or (via wildcards) mailboxes under that context. Two wildcards may be used in mailbox
: ‘*’, which matches all characters including the hierarchy delimiter (for instance, ‘/’ on a UNIX-hosted directory-based mailbox hierarchy); and ‘%’, which matches all characters except the hierarchy delimiter.
If refname
is empty, mailbox
is used directly to determine which mailboxes to match. If mailbox
is empty, the root name of refname
and the hierarchy delimiter are returned.
The return value is an array of Net::IMAP::MailboxList
. For example:
imap.create("foo/bar") imap.create("foo/baz") p imap.list("", "foo/%") #=> [#<Net::IMAP::MailboxList attr=[:Noselect], delim="/", name="foo/">, \\ #<Net::IMAP::MailboxList attr=[:Noinferiors, :Marked], delim="/", name="foo/bar">, \\ #<Net::IMAP::MailboxList attr=[:Noinferiors], delim="/", name="foo/baz">]
Sends a XLIST command, and returns a subset of names from the complete set of all names available to the client. refname
provides a context (for instance, a base directory in a directory-based mailbox hierarchy). mailbox
specifies a mailbox or (via wildcards) mailboxes under that context. Two wildcards may be used in mailbox
: ‘*’, which matches all characters including the hierarchy delimiter (for instance, ‘/’ on a UNIX-hosted directory-based mailbox hierarchy); and ‘%’, which matches all characters except the hierarchy delimiter.
If refname
is empty, mailbox
is used directly to determine which mailboxes to match. If mailbox
is empty, the root name of refname
and the hierarchy delimiter are returned.
The XLIST command is like the LIST command except that the flags returned refer to the function of the folder/mailbox, e.g. :Sent
The return value is an array of Net::IMAP::MailboxList
. For example:
imap.create("foo/bar") imap.create("foo/baz") p imap.xlist("", "foo/%") #=> [#<Net::IMAP::MailboxList attr=[:Noselect], delim="/", name="foo/">, \\ #<Net::IMAP::MailboxList attr=[:Noinferiors, :Marked], delim="/", name="foo/bar">, \\ #<Net::IMAP::MailboxList attr=[:Noinferiors], delim="/", name="foo/baz">]
Sends a STATUS command, and returns the status of the indicated mailbox
. attr
is a list of one or more attributes whose statuses are to be requested. Supported attributes include:
MESSAGES:: the number of messages in the mailbox. RECENT:: the number of recent messages in the mailbox. UNSEEN:: the number of unseen messages in the mailbox.
The return value is a hash of attributes. For example:
p imap.status("inbox", ["MESSAGES", "RECENT"]) #=> {"RECENT"=>0, "MESSAGES"=>44}
A Net::IMAP::NoResponseError
is raised if status values for mailbox
cannot be returned; for instance, because it does not exist.
Sends a STORE command to alter data associated with messages in the mailbox, in particular their flags. The set
parameter is a number, an array of numbers, or a Range
object. Each number is a message sequence number. attr
is the name of a data item to store: ‘FLAGS’ will replace the message’s flag list with the provided one, ‘+FLAGS’ will add the provided flags, and ‘-FLAGS’ will remove them. flags
is a list of flags.
The return value is an array of Net::IMAP::FetchData
. For example:
p imap.store(6..8, "+FLAGS", [:Deleted]) #=> [#<Net::IMAP::FetchData seqno=6, attr={"FLAGS"=>[:Seen, :Deleted]}>, \\ #<Net::IMAP::FetchData seqno=7, attr={"FLAGS"=>[:Seen, :Deleted]}>, \\ #<Net::IMAP::FetchData seqno=8, attr={"FLAGS"=>[:Seen, :Deleted]}>]
returns whether verify_mode is enable from POP3.ssl_params
Creates a new POP3
object and open the connection. Equivalent to
Net::POP3.new(address, port, isapop).start(account, password)
If block
is provided, yields the newly-opened POP3
object to it, and automatically closes it at the end of the session.
Net::POP3.start(addr, port, account, password) do |pop| pop.each_mail do |m| file.write m.pop m.delete end end