A short summary of this gem’s description.
Checks that the specification contains all required fields, and does a very basic sanity check.
Raises InvalidSpecificationException if the spec does not pass the checks..
Factory method to create a Gem::Requirement
object. Input may be a Version, a String
, or nil. Intended to simplify client code.
If the input is “weird”, the default version requirement is returned.
Concatenates the new
requirements onto this requirement.
Store session data on the server. For some session storage types, this is a no-op.
Yields each pair of the row as header and field tuples (much like iterating over a Hash
). This method returns the row for chaining.
If no block is given, an Enumerator
is returned.
Support for Enumerable
.
In the default mixed mode or row mode, iteration is the standard row major walking of rows. In column mode, iteration will yield
two element tuples containing the column name and an Array
of values for that column.
This method returns the table for chaining.
If no block is given, an Enumerator
is returned.
Changes the (remote) directory.
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 an AUTHENTICATE command to authenticate the client. The auth_type
parameter is a string that represents the authentication mechanism to be used. Currently Net::IMAP
supports the authentication mechanisms:
LOGIN:: login using cleartext user and password. CRAM-MD5:: login with cleartext user and encrypted password (see [RFC-2195] for a full description). This mechanism requires that the server have the user's password stored in clear-text password.
For both of these mechanisms, there should be two args
: username and (cleartext) password. A server may not support one or the other of these mechanisms; check capability()
for a capability of the form “AUTH=LOGIN” or “AUTH=CRAM-MD5”.
Authentication is done using the appropriate authenticator object: see @@authenticators for more information on plugging in your own authenticator.
For example:
imap.authenticate('LOGIN', user, password)
A Net::IMAP::NoResponseError
is raised if authentication fails.
Sends a CREATE command to create a new mailbox
.
A Net::IMAP::NoResponseError
is raised if a mailbox with that name cannot be created.
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 CHECK command to request a checkpoint of the currently selected mailbox. This performs implementation-specific housekeeping; for instance, reconciling the mailbox’s in-memory and on-disk state.
Sends a SEARCH command to search the mailbox for messages that match the given searching criteria, and returns message sequence numbers. keys
can either be a string holding the entire search string, or a single-dimension array of search keywords and arguments. The following are some common search criteria; see [IMAP] section 6.4.4 for a full list.
a set of message sequence numbers. ‘,’ indicates an interval, ‘:’ indicates a range. For instance, ‘2,10:12,15’ means “2,10,11,12,15”.
messages with an internal date strictly before <date>. The date argument has a format similar to 8-Aug-2002.
messages that contain <string> within their body.
messages containing <string> in their CC field.
messages that contain <string> in their FROM field.
messages with the Recent, but not the Seen, flag set.
negate the following search key.
“or” two search keys together.
messages with an internal date exactly equal to <date>, which has a format similar to 8-Aug-2002.
messages with an internal date on or after <date>.
messages with <string> in their subject.
messages with <string> in their TO field.
For example:
p imap.search(["SUBJECT", "hello", "NOT", "NEW"]) #=> [1, 6, 7, 8]
Starts a POP3
session and iterates over each POPMail
object, yielding it to the block
. This method is equivalent to:
Net::POP3.start(address, port, account, password) do |pop| pop.each_mail do |m| yield m end end
This method raises a POPAuthenticationError
if authentication fails.
Net::POP3.foreach('pop.example.com', 110, 'YourAccount', 'YourPassword') do |m| file.write m.pop m.delete if $DELETE end
Returns the number of messages on the POP server.
Returns an array of Net::POPMail
objects, representing all the messages on the server. This array is renewed when the session restarts; otherwise, it is fetched from the server the first time this method is called (directly or indirectly) and cached.
This method raises a POPError
if an error occurs.
This method sends a message. If msgstr
is given, sends it as a message. If block is given, yield a message writer stream. You must write message before the block is closed.
# Example 1 (by string) smtp.data(<<EndMessage) From: john@example.com To: betty@example.com Subject: I found a bug Check vm.c:58879. EndMessage # Example 2 (by block) smtp.data {|f| f.puts "From: john@example.com" f.puts "To: betty@example.com" f.puts "Subject: I found a bug" f.puts "" f.puts "Check vm.c:58879." }