Last active
August 14, 2017 13:01
-
-
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/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deliver email via maildrop-wrapper.sh | |
|~/bin/maildrop-wrapper.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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