lcmail-wizard - procmail rules and auto trash script

rox cadd3953d5 Merge branch 'make-and-new-conf' of andrearossoni/lcmail-wizard into devel 1 year ago
.forward 12eb5d860d Add default config files 4 years ago
.gitignore 93f617a9a7 Add log dir, and ignore *.log* files 4 years ago
.procmailrc 12eb5d860d Add default config files 4 years ago
Makefile e2dd689950 Makefile: more subtasks == more hackable 3 years ago
README.md 6ae807e95e README: simplify and update to track new feats 3 years ago
filter-rules.def.rc 3cc273a8af config: drop mail clones and aesthetics fix 3 years ago
lcmail-wizard.def.cron 3cc273a8af config: drop mail clones and aesthetics fix 3 years ago
lcmail-wizard.def.yml 398d4b10da Add Debian and Centos directories 3 years ago
lcmail-wizard.py d42a59c8a8 Add --create flag 4 years ago

README.md

lcmail-wizard :mailbox:

:blue_book: Description

The aim of these repo is try to facilitate new admins or 150hs to be procmail users using only LCM services to handle mails

  • Are you an admin or staff member of LCM?

    If yes, sooner or later your LCM user will be added to some or (in the worst case) all mailing lists of LCM

    If no, why are you visiting this site? Get out of here!

  • What does it mean?

    It means you will be flooded with mails every date! And yes, you can't follow the strategy INBOX for all, beacuse part of your work is to pay attention to these mails: check, reply, or even archive them

  • So what is the strategy that is usually recommended?

    For now (pre zimbra deploy), there are 2 possibilities, depending on the content of your ~/.forward you can decide to be:

    • a spam forwarder + G-slave, forwarding all your LCM mail traffic (spam included) to an external mail account (that usually permit you to make filter rules easily using webUI, e.g. Gmail)

      $ cat ~/.forward
      nomeutentelcm
      nomeutentelcm@gmail.com
      

    Pros:

    • Easy filter rules management
    • More space for mails

      Against:

      • Increase the probability to blacklist pcteor1, because (in this way) is considered the source of spam
      • Depend on external proprietary service
      • Not use self-hosted LCM services, e.g. LCM webmail
      • Little delay in mail delivery
      • Pay attention also to your ~/.maildir, that can increase significantly (LCM home quota is 1G max)
    • a procmail user, so use procmail to filter out during the delivery to local ~/.maildir the mails

      $ cat ~/.forward
      "|IFS=' '&&exec /usr/bin/procmail -f-||exit 75"
      

      Pros:

      • Learn something new
      • Know and use all the services self-hosted by LCM (dovecot [imap], roundcube [webmail], postfix [smtp])
      • Hackable filter rule system

      Against:

      • Less space available
      • Time consuming configuration
      • The procmail conf needs a bit of run-in and control to understand that everything is handled correctly

:star: Features

  • Very useful for IMAP + webmail workflow
  • Auto trash script
  • Custom configuration from a template for auto-trashing and filtering
  • Easy setup, restore and reconfigure using make

:rocket: Setup

First setup:

  • Automatic setup

    $ make install
    
  • Manual setup

    $ make init
    

    Little explanation of config files:

    • filter-rules.rc

      Copy of my procmail filter rules (filter-rules.def.rc), the file is already commented, the key idea is to filter using mail headers (^From:, ^To:, ^Subject:) and delivery to custom folder. The ~/.maildir/. folder structure must be something like that:

      .maildir/
      ├── cur -> INBOX - read mails
      ├── new -> INBOX - unread mails
      ├── tmp
      ├──  .Admins
      │   ├── cur
      │   ├── new
      │   └── tmp
      ├── .Archive
      │   ├── cur
      │   ├── new
      │   └── tmp
      |
      .
      .
      .
      |
      └── .Trash
          ├── cur
          ├── new
          └── tmp
      

      You don't have to worry about replicating it manually, because lcmail-wizard.py --create do it for you parsing dirs from lcmail-wizard.yml

    • lcmail-wizard.yml

      YAML configuration file, divided in two list mail an log (procmail and lcmail-wizard.py log)

      For mail the meaning of the integers are the number of days to wait from the reading date before trash a mail (so number of days to wait after mail is moved inside *./cur to trash it). So no mails are trashed if not read! And no mail are completly delete (removed from trash) without your interaction

      There is an exception, the 0 has special meaning, it means no expiration, don't throw any mail, even if read

      For log the same thing, but simply on creation date (no meaning here read or not read)

    • lcmail-wizard.cron

      Simple cron file, to schedule lcmail-wizard.py script

    Free to add new custom rules inside filter-rules.rc, correct workflow:

    • modify filter-rules.rc
    • new rules? Modify lcmail-wizard.yml
    • rm rules? Modify lcmail-wizard.yml

    After that:

    $ make config    # backup and copy config
    $ make schedule  # schedule python script
    

For future, free to add new custom rules inside filter-rules.rc, correct workflow:

  • modify filter-rules.rc
  • new rules? So new dirs, modify lcmail-wizard.yml
  • rm rules? So less dirs, if you want rm them manually inside ~/.maildir, if do it, delete them also inside lcmail-wizard.yml
  • make reconfig

For auto trashing feat: if you decide to modify the lcmail-wizard.yml expiration date integers you are ok always (don't be afraid to reconfigure)

:dart: Sum up

Take home messages:

  • don't be a spam-forwarder, be procmail user

  • my personal workflow is IMAP to fetch mails and get notification on mobile, and if I need to write or answer a mail I use the LCM webmail on laptop. The configuration of webmail is very simple:

    login > Gear symbol (below) > Manage folders > Enable folders you want > Happy filtering :stuck_out_tongue_winking_eye:

    Last advice in webmail, enable "Empty trash on logout"

    login > Settings (above) > Preferences > Server settings > Clear Trash on logout > Save