authenticate(auth_type, *args) public

Sends an AUTHENTICATE command to authenticate the client. The auth_type parameter is a string that represents the authentication mechanism to be used. Currently Net::IMAP supports authentication mechanisms:

LOGIN:: login using cleartext user and password. 
CRAM-MD5:: login with cleartext user and encrypted password
           (see [RFC-2195] for a full description).  This
           mechanism requires that the server have the user's
           password stored in clear-text password.

For both these mechanisms, there should be two args: username and (cleartext) password. A server may not support one or other of these mechanisms; check #capability() for a capability of the form “AUTH=LOGIN” or “AUTH=CRAM-MD5”.

Authentication is done using the appropriate authenticator object: see @@authenticators for more information on plugging in your own authenticator.

For example:

imap.authenticate('LOGIN', user, password)

A Net::IMAP::NoResponseError is raised if authentication fails.

Show source
Register or log in to add new notes.