Skip to content

Instantly share code, notes, and snippets.

@golderweb
Last active August 14, 2017 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save golderweb/4b0d8b469082e50e2a0ce86025653dc0 to your computer and use it in GitHub Desktop.
Save golderweb/4b0d8b469082e50e2a0ce86025653dc0 to your computer and use it in GitHub Desktop.
Code zum Blogpost [maildrop-Fallstricke und was man dagegen tun kann](https://golderweb.de/2017/08/maildrop-fallstricke-und-was-man-dagegen-tun-kann/)
# mailfilter
# Maildrop filter
#
# This file is just for data integrity, it includes the
# actual mailfilter in file "main"
# If any exception occurs while executing main, this file
# makes sure that the affected mail is not dropped
# DO NOT ADD ANY ADDIDTIONAL CODE OUTSIDE THE EXCEPTION SCOPE
# Catch exceptions in actual filter
exception {
# Include the actual filter
CONFIG_DIR="$HOME/etc/maildrop"
include "$CONFIG_DIR/main"
# If anything worked until now, exiting with success
# is quite fine
EXITCODE=0
exit
}
# DO NOT ADD ANY ADDIDTIONAL CODE OUTSIDE THE EXCEPTION SCOPE
# If anything goes wrong, deliver mail to Maildir
to "$HOME/Maildir"
# Deliver email via maildrop-wrapper.sh
|~/bin/maildrop-wrapper.sh
#!/bin/bash
maildrop ~/.mailfilter
if [ $? -ne 0 ]; then
# Try to correct file permissions and retry
chmod 0600 ~/.mailfilter
maildrop ~/.mailfilter
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment