mail-attachment-notifer
Processes incoming csv and xlsx mail attachments and notifies node.js with the files converted to json
introduction
Built on the popular mail-notifier module by jcreigno, this module aims to provide streamlined attachment handling for CSV and Excel XLSX files. When a new mail arrives, it is scanned for attachments, csv, xlsx, and txt files will be converted into json and a 'attachment' event will be emitted.
This module will also handle .zip
files. Each file within the zip directory will be parsed and a separate event for each file will be emitted.
Getting Started
Watch for attachments:
var attachmentNotifier = ; const imap = user: "yourimapuser" password: "yourimappassword" host: "imap.host.com" port: 993 // imap port tls: true// use secure connection tlsOptions: rejectUnauthorized: false directory: "/tmp"; var listenAttachments = ; listenAttachments; listenAttachmentsstart; listenAttachments;
installation
$ npm install mail-attachment-notifier
API
Configuration built on mail-notifier implementation
attachmentNotifier(config)
The constructor function creates a new attachmentNotifier
. Parameter provide options needed for imap connection.
config
:
host
: imap server hostport
: imap server port numberuser
: imap user namepassword
: imap passwordtls
: need a tls connection to servertlsOptions
: seetls
module optionsmarkSeen
: mark mail as read defaults to truebox
: mail box read from defaults to 'INBOX'search
: search query defaults to ['UNSEEN']directory
:write file location, default to "/tmp"
.start()
Start listening for incomming mail/attachments.
.stop()
Stop listening and close IMAP connection.
Dependencies
This module relies heavily on node-imap. For more advanced usage, please consider using it directly.