{"_id":"@digitalgarage/mail-listener","_rev":"2-2db56bd12f525722cf7e3298d41ffea7","name":"@digitalgarage/mail-listener","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@digitalgarage/mail-listener","version":"1.0.0","description":"Mail listener library for node.js. Get notification when new email arrived.","author":{"name":"Matteo Padovano","email":"mrbatista@users.noreply.github.com"},"license":"MIT","bugs":{"url":"https://github.com/digital-garage-to/mail-listener/issues"},"main":"lib/index.js","scripts":{"lint":"eslint .","lint:fix":"eslint . --fix","test":"mocha"},"repository":{"type":"git","url":"git://github.com/digital-garage-to/mail-listener/mail-listener.git"},"homepage":"https://github.com/digital-garage-to/mail-listener","keywords":["mail","job","imap","mail listener","email","email parser","node imap","mail parser"],"dependencies":{"async":"^2.6.2","imap":"^0.8.19","mailparser":"^2.4.3"},"devDependencies":{"chai":"^4.2.0","eslint":"^6.1.0","eslint-config-loopback":"^13.1.0","mocha":"^6.2.0"},"publishConfig":{"access":"public"},"gitHead":"f21c9f1232487a62a7329872dac35e187e1452d9","_id":"@digitalgarage/mail-listener@1.0.0","_nodeVersion":"10.14.2","_npmVersion":"6.9.0","dist":{"integrity":"sha512-4oyfFvBreqoeTWSOOtsyiC/nbLM7EXyjOAlMNt3SlTbmPA/bvW/JtmHVJoYJCEwYWTZBFLLYWScsxPG/ImNzZg==","shasum":"ba5ad493e4faecdebbea2d3c2c4ca0ba5ecee41c","tarball":"https://registry.npmjs.org/@digitalgarage/mail-listener/-/mail-listener-1.0.0.tgz","fileCount":4,"unpackedSize":10731,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdVHrpCRA9TVsSAnZWagAAdMIQAJ/1+Kk/m20NksHXRhMM\nJi34C6aDqtA9+75uhh5mSjER9o+xEbOsfDM5LelZyCYZiZzMYLoMqOzqAmAY\npqaq01XCKAXJep+tLIle/NSx/chHN3HRFCkdzKBYIEdMlHN7yC3UldLQcUBd\nnCyEcDMxpgfPH7cCwzH3QSIxhm1IM1cFg3oinJmNHb8mZCtZh0rmB29514ib\ndjsTKPg3iCG2io0sgiNgsS1ssx/idM62tqmotAaEEPo+X4O8Okn9Q/8D6Jp7\nWPWdRiB0EzsfaXwxXmRLaJWKay/bRKcVweW3pIjSA0BfasQNkSRy3Z38OXT6\nmP7EAoMXoeg+dHLdkWTL/Zi3TBlWSZ7Z2uD3yT+iG8iDARE4xgjc6AFZSY/d\nxrn8uquu2PFVKsM80Vvix0M77vc2kUYJL21cgHQCFupygus4QiX+dPu8IV28\nYJ5/sxd8ArX95ZxAAwFv6/uCkP+9pWNTqZIZcpWPiqmKiXSIxG04yzza02gJ\nDc008QFXRHBpRV70JymdMMjy4HJ4aBWu5tNMr+dN8rvUew8WT5h//ixF7KRv\nUvJuD4l4cXcuZybv1MtNf8gJu0aJJnclDgvnHxBn8ydH5l9rm6QNpi0UareX\nVU5a6AUYUPQri436bVeu43ZlwAd2DE8Ehk1u+EuF7IpVUkjFmRSqSMiL4lqP\n/CRi\r\n=VrKO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDLe39A458NJD0ISSiCX2xuobCwWiduDFXFP3As4B75UAiAsOljYyQRB01PZdM7bhfxlfGtLV+vjx1dFaIYaAaVXeA=="}]},"maintainers":[{"name":"mrbatista","email":"mrba7ista@gmail.com"}],"_npmUser":{"name":"mrbatista","email":"mrba7ista@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mail-listener_1.0.0_1565817577009_0.503958657592654"},"_hasShrinkwrap":false},"1.0.1":{"name":"@digitalgarage/mail-listener","version":"1.0.1","description":"Mail listener library for node.js. Get notification when new email arrived.","author":{"name":"Matteo Padovano","email":"mrbatista@users.noreply.github.com"},"license":"MIT","bugs":{"url":"https://github.com/digital-garage-to/mail-listener/issues"},"main":"lib/index.js","scripts":{"lint":"eslint .","lint:fix":"eslint . --fix","test":"mocha"},"repository":{"type":"git","url":"git://github.com/digital-garage-to/mail-listener/mail-listener.git"},"homepage":"https://github.com/digital-garage-to/mail-listener","keywords":["mail","job","imap","mail listener","email","email parser","node imap","mail parser"],"dependencies":{"async":"^2.6.2","imap":"^0.8.19","mailparser":"^2.4.3"},"devDependencies":{"chai":"^4.2.0","eslint":"^6.1.0","eslint-config-loopback":"^13.1.0","mocha":"^6.2.0"},"publishConfig":{"access":"public"},"gitHead":"c346f698b39088d87e8678e6d78a18036b2403ce","_id":"@digitalgarage/mail-listener@1.0.1","_nodeVersion":"10.14.2","_npmVersion":"6.9.0","dist":{"integrity":"sha512-j8xWEFh14k7/JXBEv5j/rwYF4ATmFgZXB5G+a8hSy8wSnUtVlEBrYofXQjhOFFoZa6QNc2MJXHRLEUZyPWwiCw==","shasum":"a078b0d8b5cc3329aa4aae927436746dedb24350","tarball":"https://registry.npmjs.org/@digitalgarage/mail-listener/-/mail-listener-1.0.1.tgz","fileCount":5,"unpackedSize":13326,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdy1y6CRA9TVsSAnZWagAAnVgP/2R5xXyUDJi3d7ssyYj9\nZ13H32RhgZUAzX5UmE+ft8y+GqHh3pDxVLZ+hdVKP7SE9O/wjUSsGErhGGsM\nQHB42IAc+b0fspCdPtIv50heGCRmzSCHc+fI7EbBNpSf0kIpz6/zZCj05/nT\nQ70Os6tDsKbQVvmtfskBUkbZnB+Gif5BUCQTJtsMfZuT3FN2KjxrAITsEhdG\nWX1NegXw1gV1qxnHtSwYLqrKfdDwm+g+wEwvaU7L/U+C8ORIxkw2bqpZcPxZ\n08p8hAOgYNOTEUNBNHsq1mrBSBUk11ny8PWNkcTyFpNLIDwuRiL5fhyS51/V\nh830YuEkWEesI8YRPMw1u3ElHK7VQOYArqTTpnQkWk0iIf+DU5T36Je9nPBb\noaaRb3mo3QpIZ+zWPIdRCDzVlgcirc1uXXlNpK5mf/aAmcF0CT5JwyepysHZ\nPmujlGU68O4fPEpb/qKJyWZfp7KTM8tBP7QcLGFHDBt70nlQBEBOpwil2ueW\nCUzOG9JeWsuLLWe5uqBE41YFpBm40gjvAuPfv2JVFASkGhH2l3gV7xO0O3cv\nLD31JlI5b9HR9GWIhMTOd6bDHwTFiqnpR+UjTJ3zn9wp3adl1oAB9fTRR2WS\nF64JsGRLn4Nd0eRANPBt0Dj3WvB7ZcfTwPpgON5lhZ7qyGeNzNLLkglmzlWt\nHhVA\r\n=BE9i\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICak+7o5IuHjiM8BZ85/FB52DU67QC6y07xsx2kPxfSBAiAoQDPKo3cuyOxUDvVXYUSrqyexmKwCVdfQ59AsOceNlw=="}]},"maintainers":[{"name":"mrbatista","email":"mrba7ista@gmail.com"}],"_npmUser":{"name":"mrbatista","email":"mrba7ista@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mail-listener_1.0.1_1573608634022_0.6972354438692974"},"_hasShrinkwrap":false}},"time":{"created":"2019-08-14T21:19:36.817Z","1.0.0":"2019-08-14T21:19:37.234Z","modified":"2022-04-05T04:37:33.079Z","1.0.1":"2019-11-13T01:30:34.172Z"},"maintainers":[{"name":"mrbatista","email":"mrba7ista@gmail.com"}],"description":"Mail listener library for node.js. Get notification when new email arrived.","homepage":"https://github.com/digital-garage-to/mail-listener","keywords":["mail","job","imap","mail listener","email","email parser","node imap","mail parser"],"repository":{"type":"git","url":"git://github.com/digital-garage-to/mail-listener/mail-listener.git"},"author":{"name":"Matteo Padovano","email":"mrbatista@users.noreply.github.com"},"bugs":{"url":"https://github.com/digital-garage-to/mail-listener/issues"},"license":"MIT","readme":"# Overview\n\nmail-listener library for node.js. Get notification when new email arrived to inbox or when message metadata (e.g. flags) changes externally. Uses IMAP protocol.\n\nWe are using these libraries: [node-imap](https://github.com/mscdex/node-imap), [mailparser](https://github.com/nodemailer/mailparser).\n\nHeavily inspired by [mail-listener2](https://github.com/chirag04/mail-listener2) and [mail-listener5](https://github.com/Pranav-Dakshina/mail-listener2).\n\nNOTE: This version is designed to work with & tested on NodeJS v 10.15.2 LTS, the most recent LTS version as at March 2019. It might not work on older versions of Node.\n\n## Use\n\nInstall\n\n`npm install @digital-garage-to/mail-listener`\n\n```javascript\n\nconst MailListener = require('mail-listener');\n\nconst mailListener = new MailListener({\n  imapOptions: {\n    username: 'imap-username',\n    password: 'imap-password',\n    host: 'imap-host',\n    port: 993, // imap port\n    tls: true,\n    connTimeout: 10000, // Default by node-imap\n    authTimeout: 5000, // Default by node-imap,\n    debug: console.log, // Or your custom function with only one incoming argument. Default: null\n    tlsOptions: { rejectUnauthorized: false },\n  },\n  mailbox: 'INBOX', // mailbox to monitor\n  searchFilter: ['ALL'], // the search filter being used after an IDLE notification has been retrieved\n  markSeen: true, // all fetched email willbe marked as seen and not fetched next time\n  fetchOnStart: true, // use it only if you want to get all unread email on lib start. Default is `false`,\n  attachments: true, // download attachments as they are encountered to the project directory\n  attachmentOptions: {\n    directory: 'attachments/', // specify a download directory for attachments\n    customFilename: attachment => {\n      return 'test.zip';\n    };\n  }\n});\n\nmailListener.start(); // start listening\nmailListener.stop(); // stop listening\n\nmailListener.on('server:connected', () => {\n  console.log('imap connected');\n});\n\nmailListener.on('mailbox', mailbox => {\n  console.log('Total number of mails: ', mailbox.messages.total); // this field in mailbox gives the total number of emails\n});\n\nmailListener.on('server:disconnected', () => {\n  console.log('imap disconnected');\n});\n\nmailListener.on('error', err => {\n  console.log('Error: ', err);\n});\n\nmailListener.on('headers', (headers, seqno) => {\n  // do something with mail headers\n});\n\nmailListener.on('body', (body, seqno) => {\n  // do something with mail body\n})\n\nmailListener.on('attachment', (attachment, seqno) => {\n  // do something with attachment\n});\n\nmailListener.on('mail', (mail, seqno) => {\n  // do something with the whole email as a single object\n})\n\n// it's possible to access imap object from node-imap library for performing additional actions. E.x.\nmailListener.imap.move(:msguids, :mailboxes);\n\n```\n\n## Attachments\n\nSetting `attachments: true` will download attachments as stream to the project directory.\nA specific download directory may be specified by setting `attachmentOptions: { directory: 'attachments/'}`.\nThe `'attachment'` event will be fired every time an attachment is encountered.\nTo customize the name of file downloaded specific a `customFilename` function.\n\n## License\n\nMIT\n","readmeFilename":"readme.md"}