Skip to content
/ sumo Public

Get scheduled summaries of new mails in an imap directory.

License

Notifications You must be signed in to change notification settings

timomeh/sumo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sumo

For those mails which aren't important, but you still want to keep an eye on them.

sumo is a productivity tool, which periodically checks a directory (or Gmail label) in your mail inbox for new mails, sends you a summary of them and marks those mails as read. Keep your inbox clean, but also don't miss something! Currently it sends the summary via mail, but sumo is programmed to be extendable with more adapters. Feel free to contribute more adapters! 🎉

A mail containing a list of new mails? This may sound silly, but it really isn't.

This works perfectly with mailbox filters. Move those mails, which aren't really important (like newsletters or spammy mails), automatically in a separate directory and keep your Inbox clean. Lean back and let sumo send you a summary of those mails daily, once a week or whenever you'd like to. You can read more about my usecase and why I built sumo in the section Background.

Table of Contents

Background

I get a lot of spam to the email address, which is listed in the WHOIS of my domains. But sometimes important mails can get delivered to that email address, like mails from ICANN. With sumo, I can use an email alias like "[email protected]" in my WHOIS, and configure an appropriate Gmail filter, which archives and labels mails delivered to that address. Now those mails won't distract me, but once a week I get a summary and can see if I got an important mail between all those spam mails.

Usage, the very simple way

  1. Deploy it to a free Heroku Dyno:
    Deploy
  2. Fill out the necessary environment variables.
  3. Configure the Heroku Scheduler to call npm start whenever you'd like to.

Hint: If you want to run the Scheduler every few days, choose Daily, the desired time, and use something like this:

if [ "$(date +%u)" = 3 ]; then npm start; fi

… where 3 is the third day of the week, Wednesday. Then it will only be executed on a Wednesday. 🙃

Usage, the manual way

  1. Clone this repository
  2. npm install
  3. npm start runs the worker and exits.
  4. You need a scheduler, which runs npm start on your behalf every few days or however you like it

Requirements

  • Node (a newer version)
  • npm (5 would be good)
  • A scheduler would be great

More useful Informations

Usage with Gmail

If you want to use sumo with your Gmail Account, you need to create an App password. Your Google password won't work.

Want to check more inboxes, directories, labels?

Simply deploy more instances. 🙂

Contribute

Feel free to contribute! 🚀 More Adapters would be great. Everything is possible. Slack, Telegram, Fax, you name it.

  1. Add a new file to /adapters (see /adapters/smpt.js for an example)
  2. Register it in /lib/send-to-adapter.js
  3. Set the SUMO_ADATER environment variable to your new registered adapter.
  4. Open a Pull Request so everyone can use your awesome adapter!

If you need to provide customizable data, use environment variables.

Example:

// lib/send-to-adapter.js
'use strict'

const adapters = {
  SMTP: require('../adapters/smtp'),
  FANCY: require('../adapters/fancy-thing') // <- this is your new adapter!
                                            // To use it, set the env variable
                                            // SUMO_ADATER to FANCY
}

// ... No need to modify things below.
// adapters/fancy-thing.js

'use strict'

const GenericAdapter = require('../lib/generic-adapter')

module.exports = class FancyAdapter extends GenericAdapter {
  constructor(mails) {
    super(mails)

    // `this.mails = mails` is already configured in the Superclass.
  }

  run() {
    // this.mails is an array of all new mails as mailparser headers:
    // https://nodemailer.com/extras/mailparser/

    const firstFrom = this.mails[0].headers.get('from').text
    const firstSubject = this.mails[0].headers.get('subject')
    const firstDate = this.mails[0].headers.get('date')

    // ...and now send this to some service!
  }
}

License

MIT © Timo Mämecke

About

Get scheduled summaries of new mails in an imap directory.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published