true
if the SMTP
session has been started.
Opens a TCP connection and starts the SMTP
session.
helo
is the HELO domain that you’ll dispatch mails from; see the discussion in the overview notes.
If both of user
and secret
are given, SMTP
authentication will be attempted using the AUTH command. authtype
specifies the type of authentication to attempt; it must be one of :login, :plain, and :cram_md5. See the notes on SMTP
Authentication in the overview.
When this methods is called with a block, the newly-started SMTP
object is yielded to the block, and automatically closed after the block call finishes. Otherwise, it is the caller’s responsibility to close the session when finished.
This is very similar to the class method SMTP.start
.
require 'net/smtp' smtp = Net::SMTP.new('smtp.mail.server', 25) smtp.start(helo_domain, account, password, authtype) do |smtp| smtp.send_message msgstr, 'from@example.com', ['dest@example.com'] end
The primary use of this method (as opposed to SMTP.start
) is probably to set debugging (set_debug_output
) or ESMTP (esmtp=
), which must be done before the session is started.
If session has already been started, an IOError
will be raised.
This method may raise:
Sets the resolver timeouts. This may be a single positive number or an array of positive numbers representing timeouts in seconds. If an array is specified, a DNS
request will retry and wait for each successive interval in the array until a successful response is received. Specifying nil
reverts to the default timeouts:
Example:
dns.timeouts = 3
Sets the parent of this child to the supplied argument.
Must be a Parent
object. If this object is the same object as the existing parent of this child, no action is taken. Otherwise, this child is removed from the current parent (if one exists), and is added to the new parent.
The parent added
@return the XMLDecl
version of this document as a String. If no XMLDecl
has been set, returns the default version.
Evaluates to true
if whitespace is respected for this element. This is the case if:
Neither :respect_whitespace
nor :compress_whitespace
has any value
The context has :respect_whitespace
set to :all
or an array containing the name of this element, and :compress_whitespace
isn’t set to :all
or an array containing the name of this element.
The evaluation is tested against expanded_name
, and so is namespace sensitive.
Registers for notifications of event ev
on the proxied TupleSpace
. See TupleSpace#notify
Called by TupleSpace
to notify this NotifyTemplateEntry
of a new event.
Registers for notifications of event
. Returns a NotifyTemplateEntry
. See NotifyTemplateEntry
for examples of how to listen for notifications.
event
can be:
A tuple was added
A tuple was taken or moved
A tuple was lost after being overwritten or expiring
The TupleSpace
will also notify you of the ‘close’ event when the NotifyTemplateEntry
has expired.