3.0.0 • Published 1 year ago

last-gmail v3.0.0

Weekly downloads
41
License
MIT
Repository
github
Last release
1 year ago

last-gmail

Simple wrapper around imap and mailparser that fetches, parses, and returns the most recent email that has been received by a gmail account.

Usage

Simply require in last-gmail, pass in the account details (only user and password are required, all other are optional and are documented here), and call getLastEmail. The async function returns the results, and any errors are thrown.

const gmail = require('last-gmail');

const opts = {
    user: 'example@gmail.com',
    password: 'password',
    mailbox: 'INBOX' // Optional, default: [Gmail]/All Mail
};

try {
    const email = await gmail.getLastEmail(opts);

    console.log('to:', email.to);
    console.log('from:', email.from);
    email.text && console.log('text:', email.text);
    email.html && console.log('html:', email.html);
} catch (err) {
    console.error(err);
}
3.0.0

1 year ago

2.2.2

1 year ago

2.2.1

2 years ago

2.2.0

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

5 years ago

1.0.1

7 years ago

1.0.0

7 years ago