new(host, port_or_options = {}, usessl = false, certs = nil, verify = true) public

Creates a new Net::IMAP object and connects it to the specified host.

options is an option hash, each key of which is a symbol.

The available options are:


Port number (default value is 143 for imap, or 993 for imaps)


If options[:ssl] is true, then an attempt will be made to use SSL (now TLS) to connect to the server. For this to work OpenSSL [OSSL] and the Ruby OpenSSL [RSSL] extensions need to be installed. If options[:ssl] is a hash, it’s passed to OpenSSL::SSL::SSLContext#set_params as parameters.


Seconds to wait until a connection is opened

The most common errors are:


Connection refused by host or an intervening firewall.


Connection timed out (possibly due to packets being dropped by an intervening firewall).


There is no route to that network.


Hostname not known or other socket error.


The connected to the host was successful, but it immediately said goodbye.

Show source
Register or log in to add new notes.