0.1.10 • Published 7 years ago

mail-attachment-notifier v0.1.10

Weekly downloads
60
License
-
Repository
github
Last release
7 years ago

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 = require('mail-attachment-notifier');

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 = attachmentNotifier(imap);

  listenAttachments.on('attachment', data => console.log(data));
  listenAttachments.start();
  listenAttachments.stop();

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 host
  • port : imap server port number
  • user : imap user name
  • password : imap password
  • tls : need a tls connection to server
  • tlsOptions : see tls module options
  • markSeen: mark mail as read defaults to true
  • box : 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.

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago