Enable SSL for all new instances. params
is passed to OpenSSL::SSLContext#set_params.
Enables SSL for this instance. Must be called before the connection is established to have any effect. params[:port]
is port to establish the SSL connection on; Defaults to 995. params
(except :port) is passed to OpenSSL::SSLContext#set_params.
Set
the read timeout.
true if server advertises STARTTLS. You cannot get valid value before opening SMTP
session.
Enables SMTP/TLS (SMTPS: SMTP
over direct TLS connection) for this object. Must be called before the connection is established to have any effect. context
is a OpenSSL::SSL::SSLContext
object.
Enables SMTP/TLS (STARTTLS) for this object. context
is a OpenSSL::SSL::SSLContext
object.
Set
the number of seconds to wait until timing-out a read(2) call.
Sends msgstr
as a message. Single CR (“r”) and LF (“n”) found in the msgstr
, are converted into the CR LF pair. You cannot send a binary message with this method. msgstr
should include both the message headers and body.
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') do |smtp| smtp.send_message msgstr, 'from@example.com', ['dest@example.com', 'dest2@example.com'] end
This method may raise:
Parses arg
and returns rest of arg
and matched portion to the argument pattern. Yields when the pattern doesn’t match substring.
see Enumerator
#with_index.
see Enumerator
#with_object.
Replaces this object with another object. Basically, calls Parent.replace_child
self
Adds a child to this element, optionally setting attributes in the element.
optional. If Element
, the element is added. Otherwise, a new Element
is constructed with the argument (see Element.initialize).
If supplied, must be a Hash
containing String name,value pairs, which will be used to set the attributes of the new Element
.
the Element
that was added
el = doc.add_element 'my-tag' el = doc.add_element 'my-tag', {'attr1'=>'val1', 'attr2'=>'val2'} el = Element.new 'my-tag' doc.add_element el
Deletes a child element.
Must be an Element
, String
, or Integer
. If Element
, the element is removed. If String, the element is found (via XPath
) and removed. <em>This means that any parent can remove any descendant.<em> If Integer
, the Element
indexed by that number will be removed.
the element that was removed.
doc.delete_element "/a/b/c[@id='4']" doc.delete_element doc.elements["//k"] doc.delete_element 1
Evaluates to true
if this element has at least one child Element
doc = Document.new "<a><b/><c>Text</c></a>" doc.root.has_elements # -> true doc.elements["/a/b"].has_elements # -> false doc.elements["/a/c"].has_elements # -> false
Synonym for Element.elements
.each