When true
, connections are in passive mode per default. Default: true
.
When true
, connections are in passive mode per default. Default: true
.
The default port to use for HTTP
requests; defaults to 80.
true if the response has a body.
Gets the entity body returned by the remote HTTP server.
If a block is given, the body is passed to the block, and the body is provided in fragments, as it is read in from the socket.
If dest
argument is given, response is read into that variable, with dest#<<
method (it could be String
or IO
, or any other object responding to <<
).
Calling this method a second or subsequent time for the same HTTPResponse
object will return the value already read.
http.request_get('/index.html') {|res| puts res.read_body } http.request_get('/index.html') {|res| p res.read_body.object_id # 538149362 p res.read_body.object_id # 538149362 } # using iterator http.request_get('/index.html') {|res| res.read_body do |segment| print segment end }
The default port for IMAP
connections, port 143
Similar to move()
, but set
contains unique identifiers.
Decode a string from modified UTF-7 format to UTF-8.
UTF-7 is a 7-bit encoding of Unicode [UTF7]. IMAP
uses a slightly modified version of this to encode mailbox names containing non-ASCII characters; see [IMAP] section 5.1.3.
Net::IMAP
does not automatically encode and decode mailbox names to and from UTF-7.
returns the port for POP3
Starts a POP3
session and deletes all messages on the server. If a block is given, each POPMail
object is yielded to it before being deleted.
This method raises a POPAuthenticationError
if authentication fails.
Net::POP3.delete_all('pop.example.com', 110, 'YourAccount', 'YourPassword') do |m| file.write m.pop end
Enable SSL for all new instances. params
is passed to OpenSSL::SSLContext#set_params.
Disable SSL for all new instances.
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.
Disable SSL for all new instances.
Deletes all messages on the server.
If called with a block, yields each message in turn before deleting it.
n = 1 pop.delete_all do |m| File.open("inbox/#{n}") do |f| f.write m.pop end n += 1 end
This method raises a POPError
if an error occurs.
The default SMTP
port number, 25.
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.
Disables SMTP/TLS for this object. Must be called before the connection is established to have any effect.