All Projects → jcreigno → Nodejs Mail Notifier

jcreigno / Nodejs Mail Notifier

Licence: mit
nodejs library to listen incoming mail

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Nodejs Mail Notifier

imapx
A cross-platform IMAP library for .NET, supporting .Net 2.0 - 4.5, Mono and Windows Phone
Stars: ✭ 28 (-79.41%)
Mutual labels:  mail, imap
Sieve
Sieve Script Editor
Stars: ✭ 452 (+232.35%)
Mutual labels:  mail, imap
Rainloop Webmail
Simple, modern & fast web-based email client
Stars: ✭ 3,618 (+2560.29%)
Mutual labels:  mail, imap
himalaya
Command-line interface for email management
Stars: ✭ 1,715 (+1161.03%)
Mutual labels:  mail, imap
Docker Mailserver
Production-ready fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.) running inside a container.
Stars: ✭ 8,115 (+5866.91%)
Mutual labels:  mail, imap
ESP-Mail-Client
⚡️Arduino Mail Client Library to send, read and get incoming mail notification for ESP32, ESP8266 and SAMD21 devices. The library also supported other Arduino devices using Clients interfaces e.g. WiFiClient, EthernetClient, and GSMClient.
Stars: ✭ 78 (-42.65%)
Mutual labels:  mail, imap
Mail
Library to send e-mails over different transports and protocols (like SMTP and IMAP) using immutable messages and streams. Also includes SMTP server.
Stars: ✭ 399 (+193.38%)
Mutual labels:  mail, imap
go-imap-idle
IDLE extension for go-imap
Stars: ✭ 30 (-77.94%)
Mutual labels:  mail, imap
Hydroxide
A third-party, open-source ProtonMail CardDAV, IMAP and SMTP bridge
Stars: ✭ 578 (+325%)
Mutual labels:  mail, imap
James Project
Emails at the heart of your business logic!
Stars: ✭ 485 (+256.62%)
Mutual labels:  mail, imap
IMAPLoginTester
A simple Python script that reads a text file with lots of e-mails and passwords, and tries to check if those credentials are valid by trying to login on IMAP servers.
Stars: ✭ 47 (-65.44%)
Mutual labels:  mail, imap
Go Imap
📥 An IMAP library for clients and servers
Stars: ✭ 1,217 (+794.85%)
Mutual labels:  mail, imap
fs2-mail
asynchronous library for sending and receiving mail via fs2._
Stars: ✭ 39 (-71.32%)
Mutual labels:  mail, imap
Excision-Mail
Fullstack, security focused mailserver based on OpenSMTPD for OpenBSD using ansible
Stars: ✭ 108 (-20.59%)
Mutual labels:  mail, imap
skirnir
Skirnir Email Server
Stars: ✭ 31 (-77.21%)
Mutual labels:  mail, imap
Mailcow Dockerized
mailcow: dockerized - 🐮 + 🐋 = 💕
Stars: ✭ 4,573 (+3262.5%)
Mutual labels:  mail, imap
hermes
Automates programmables à réaction aux échanges électroniques depuis une boîte IMAP4
Stars: ✭ 15 (-88.97%)
Mutual labels:  mail, imap
Mail
The Hoa\Mail library.
Stars: ✭ 24 (-82.35%)
Mutual labels:  mail, imap
Neutron
Self-hosted server for the ProtonMail client
Stars: ✭ 452 (+232.35%)
Mutual labels:  mail, imap
Imapcopy
Recursively copy all e-mail messages and folders from one IMAP account to another.
Stars: ✭ 52 (-61.76%)
Mutual labels:  mail, imap

mail-notifier

Notify your nodejs scripts of incoming imap mail.

introduction

Send mail event for each new email in IMAP INBOX.

synopsis

Start listening new mails :

const notifier = require('mail-notifier');

const imap = {
  user: "yourimapuser",
  password: "yourimappassword",
  host: "imap.host.com",
  port: 993, // imap port
  tls: true,// use secure connection
  tlsOptions: { rejectUnauthorized: false }
};

notifier(imap)
  .on('mail', mail => console.log(mail))
  .start();

Keep it running forever :

const n = notifier(imap);
n.on('end', () => n.start()) // session closed
  .on('mail', mail => console.log(mail.from[0].address, mail.subject))
  .start();

Note: If using a Gmail account, you will need to do two things:

  1. Enable IMAP in your Gmail account settings, which is detailed here.
  2. Authorize "less secure apps", which you is laid out in "Option 2" here.

installation

$ npm install mail-notifier

API

notifier(config, customDbg)

The constructor function creates a new notifier. 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 tle 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']
  • connTimeout : Number of milliseconds to wait for a connection to be established. Default: 10000
  • authTimeout : Number of milliseconds to wait to be authenticated after a connection has been established. Default: 5000
  • debug: function - if set, the function will be called with one argument, a string containing some debug info. Default: debug output if enabled.

Options from node-imap are also avaliable.

For backward compatibility username is supported.

custommDbg: function - if set, the function will be called with args that contain some mail-notifier debug info. Default: debug output if enabled.

example:

const n = notifier(config, (...args) => {
  const msg = util.format(...args);
  customLogFn(msg);
});

.start()

Start listening for incomming emails.

.stop()

Stop listening and close IMAP connection.

Events

'connected'

Sent when a connection to the server has been made.

'mail'

Sent on incoming new unread email. The parsed Mail is given as first parameter to the event listener.

'error'

Sent when an error occurs with the IMAP connection. The first parameter is the err object.

'end'

Sent when the IMAP connection is closed. This usually happens after a stop method call.

Dependencies

This module relies heavily on node-imap. For more advanced usage, please consider using it directly.

Debugging

Debugging is enabled via the visionmedia/debug module.

To enable debug info add mailnotifier to the DEBUG env variable :

$>DEBUG=mailnotifier node sample/simple-mail-notifier.js

Or to also have imap module debug info :

$>DEBUG=mailnotifier,imap node sample/simple-mail-notifier.js
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].