The mdsort utility moves messages from one maildir to another according
to a set of user defined rules. The rule syntax should be familiar to
users of OpenBSD. Example configuration:

  $ cat ~/.mdsort.conf
  maildir "~/Maildir/INBOX" {
    # Move messages from OpenBSD mailing lists into dedicated directories.
    match header { "Cc" "To" } /(bugs|misc|ports|tech)@openbsd.org/i \
      move "~/Maildir/openbsd-\1"

    match header { "Cc" "To" } /(ports|source)-chan...@openbsd.org/i \
      move "~/Maildir/openbsd-cvs"

    # Get rid of potential spam.
    match header "Received-SPF" /fail/ or header "X-Spam-Score" /[1-9]/ \
      move "~/Maildir/Spam"

    # Archive read messages.
    match ! new move "~/Maildir/Archive"

Rules can be inspected using the dry run option: instead of moving
messages, it shows which messages would be moved and why:

  $ mdsort -d
  /home/anton/Maildir/INBOX/new/1521917295.19872_29.puffy -> 
  Cc: t...@openbsd.org
      ^              $

The manuals are available online[1] and the code over here[2].

OK to import? (I'm the author)

[1] https://mptre.github.io/mdsort/
[2] https://github.com/mptre/mdsort

Attachment: mdsort.tar.gz
Description: application/tar-gz

Reply via email to