Giter Site home page Giter Site logo

hash-mail's Introduction

hash-mail

Generate mail hashes that ignore HTML metadata for efficient de-duplication

Ever been in a situation where you are getting a ton of duplicate emails, only difference between them being some of the HTML metadata (e.g. embedded trackers) ? Then this program is for you.

Very simple, hash-mail reads an email on stdin, parses it, and generate a hash ignoring anything enclosed in HTML tags.

The resulting hash can be used with sieve filters to deduplicate.

The script uses one environment variable as a temp folder where emails that failed parsing should be stored: HMAIL_FAIL_DIR

Example procmailrc:

# fail folder for hash-mail
HMAIL_FAIL_DIR="/path/to/fail/"

# Add a checksum of the body to remove duplicate
:0
{
  :0 hb
  SHASUM=|/path/to/hash-mail

  :0 fh
  |formail -I"X-SHA-MyHash:"

  :0 fh
  |formail -I"X-SHA-MyHash: $SHASUM"
}

Then a possible sieve filter would contain this:

require ["duplicate","fileinto"];
# rule:[duplicates]
if allof (duplicate :header "X-SHA-MyHash")
{
    fileinto "dupes";
    stop;
}

And boom, all duplicated emails sent within the last X days (7 by default with dovecot) would land in that "dupes" mailbox.

hash-mail's People

Contributors

rand0mdud3 avatar

Watchers

Neustradamus avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.