imap-regex-finder

1.2.0 • Public • Published

Imap-regex-finder

For example, if you need to extract steam confrimation codes from your mailbox:

const { imapFindMatchedPatterns } = require('imap-regex-finder');

const creds = {
    user: 'YOUR_EMAIL',
    password: 'YOUR_PASSWORD',
    host: 'imap.mail.ru',
    port: 993,
    tls: true,
}

const codeFindRegex = new RegExp('\\r\\n[\\t+]{5,}([A-Z0-9]{5})[\\t]{5,}<\/td>', 'gm');

function recent5Hours() {
    const delay = 5 * 3600 * 1000;
    const recent = new Date();
    recent.setTime(Date.now() - delay);
    return recent;
}

async function main() {
    const codes = await imapFindMatchedPatterns(creds, new RegExp('Steam Account Recovery'), codeFindRegex, recent5Hours());
    console.debug(codes);
}

main()
    .then(() => console.debug('done'))
    .catch(err => console.error(err));

Package Sidebar

Install

npm i imap-regex-finder

Weekly Downloads

1

Version

1.2.0

License

ISC

Unpacked Size

2.96 kB

Total Files

3

Last publish

Collaborators

  • mdfitumi