Adds a response handler. For example, to detect when the server sends a new EXISTS response (which normally indicates new messages being added to the mailbox), add the following handler after selecting the mailbox:
imap.add_response_handler { |resp| if resp.kind_of?(Net::IMAP::UntaggedResponse) and resp.name == "EXISTS" puts "Mailbox now has #{resp.data} messages" end }
Removes the response handler.
Opens a message writer stream and gives it to the block. The stream is valid only in the block, and has these methods:
outputs STR and CR LF.
outputs STR.
outputs sprintf(fmt,*args).
outputs STR and returns the length of written bytes.
outputs STR and returns self.
If a single CR (“r”) or LF (“n”) is found in the message, it is converted to the CR LF pair. You cannot send a binary message with this method.
from_addr
is a String representing the source mail address.
to_addr
is a String or Strings or Array of Strings, representing the destination mail address or addresses.
Net::SMTP.start('smtp.example.com', 25) do |smtp| smtp.open_message_stream('from@example.com', ['dest@example.com']) do |f| f.puts 'From: from@example.com' f.puts 'To: dest@example.com' f.puts 'Subject: test message' f.puts f.puts 'This is a test message.' end end
This method may raise:
The get_attribute_ns
method retrieves a method by its namespace and name. Thus it is possible to reliably identify an attribute even if an XML
processor has changed the prefix.
Method
contributed by Henrik Martensson
Returns the first found remote TupleSpace
. Any further recovered TupleSpaces can be found by calling to_a
.
The full path to the gem (install path + full name).
Return all files in this gem that match for glob
.
Returns a string usable in Dir.glob
to match all requirable paths for this spec.
Display to the user that a gem couldn’t be found and reasons why
Creates an option parser and fills it in with the help info for the command.
Checks the permissions of the credentials file. If they are not 0600 an error message is displayed and RubyGems aborts.