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." }
Returns the path from an FTP
URI
.
RFC 1738 specifically states that the path for an FTP
URI
does not include the / which separates the URI
path from the URI
host. Example:
ftp://ftp.example.com/pub/ruby
The above URI
indicates that the client should connect to ftp.example.com then cd to pub/ruby from the initial login directory.
If you want to cd to an absolute directory, you must include an escaped / (%2F) in the path. Example:
ftp://ftp.example.com/%2Fpub/ruby
This method will then return “/pub/ruby”.
Produces the summary text. Each line of the summary is yielded to the block (without newline).
sdone
Already summarized short style options keyed hash.
ldone
Already summarized long style options keyed hash.
width
Width of left side (option part). In other words, the right side (description part) starts after width
columns.
max
Maximum width of left side -> the options are filled within max
columns.
indent
Prefix string indents all summarized lines.
Adds sw
according to sopts
, lopts
and nlopts
.
sw
OptionParser::Switch
instance to be added.
sopts
Short style option list.
lopts
Long style option list.
nlopts
Negated long style options list.
Searches key
in id
list. The result is returned or yielded if a block is given. If it isn’t found, nil is returned.
Creates the summary table, passing each line to the block
(without newline). The arguments args
are passed along to the summarize method which is called on every option.
Iterates the given block for each prime number.