Provides methods for working with email.


init(user, password, host, port, tls, authTimeout)

Set email connection details.

Name Type Description
user String Username (e.g. 'your@email.address').
password String Password.
host String Host name (e.g. '').
port Number Port number (e.g. 993).
tls Boolean true to use TLS, false otherwise.
authTimeout Number Authentication timeout.

getLastEmail(sinceMinutes, subject, timeout)→ {Object}

Retrieves last unseen email.

Name Type Description
sinceMinutes Number Search for emails received since the specified amount of minutes into past.
subject (String|Regex) Return email matching the specified subject.
timeout String Timeout for waiting for the message to arrive.
Object - Email body and TO, FROM, SUBJECT, DATE headers.