This repository has been archived on 2023-01-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mail-config/astroid/poll.sh

54 lines
1.4 KiB
Bash
Raw Normal View History

2017-04-13 12:28:53 +02:00
#!/bin/bash
CURDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TMP=/tmp/status
source "$TMP"
# Move selectedly tagged mails to folders if they are only in INBOX
echo "[DEBUG] Move tagged mails in INBOX to folders"
2017-04-13 12:28:53 +02:00
bash $CURDIR/scripts/move-tag.sh
# If offline mode, do a quick sync
if [ "$var_conn" == "off" ]; then
echo "[INFO] Offline mode enabled. Do a quick sync"
offlineimap -q
else
echo "[INFO] Do a normal sync."
2017-04-13 12:28:53 +02:00
offlineimap
fi
echo "[DEBUG] Sync notmuch database with new mails"
2017-04-13 12:28:53 +02:00
notmuch new
### Sort emails
# Trash mod requests, Junk, Trash
echo "[DEBUG] Tag mails in ignore, spam, and trash folders"
2017-04-13 12:28:53 +02:00
notmuch tag +ignore -unread -- path:Lists.MOD.Trash/**
notmuch tag +spam -- path:INBOX.Junk/**
notmuch tag +del -unread -- path:Trash/**
# Moderation
echo "[DEBUG] Tag list moderation mails"
2017-04-13 12:28:53 +02:00
notmuch tag +mod -- path:Lists.MOD/**
# CVS
echo "[DEBUG] Tag cvs mails" # TODO is this necessary?
2017-04-13 12:28:53 +02:00
notmuch tag +cvs -- path:Lists.Web.CVS-Notify/**
# Sent
#notmuch tag +sent -unread -- path:Sent/**
# Archiv
echo "[DEBUG] Tag mails in offline ARCHIVE folder"
2017-04-13 12:28:53 +02:00
notmuch tag +archive -- path:ARCHIVE/**
# Automatic tagging based on location of mails in folders
echo "[DEBUG] Tag mails based on their folder"
2017-04-13 12:28:53 +02:00
bash $CURDIR/scripts/tag-folder.sh # generates commands from tag-folder.csv
bash $CURDIR/scripts/tag-folder-rules.sh # executes generated commands
echo "[DEBUG] poll.sh exited successfully"