Keep email encryption as the final step in procmail

This commit is contained in:
Bob Mottram 2016-02-11 11:48:30 +00:00
parent 5e37bab6be
commit cd5291851b
1 changed files with 9 additions and 12 deletions

View File

@ -101,22 +101,19 @@ chown -R $MYUSERNAME:$MYUSERNAME $LISTDIR
if ! grep -q "Subject:.*()\[$SUBJECTTAG\]" $PM; then
if ! grep -q "\# encrypt" $PM; then
echo "" >> $PM
echo "/# Email rule for $MAILINGLIST subject \[$SUBJECTTAG\]" >> $PM
echo ":0" >> $PM
echo " * ^Subject:.*()\[$SUBJECTTAG\]" >> $PM
echo "$LISTDIR/new" >> $PM
echo "/# End of rule" >> $PM
chown $MYUSERNAME:$MYUSERNAME $PM
else
sed -i "/\# encrypt/i
/# Email rule for $MAILINGLIST subject \[$SUBJECTTAG\]
filter="
# Email rule for $MAILINGLIST subject [$SUBJECTTAG]
:0
* ^Subject:.*()\[$SUBJECTTAG\]
$LISTDIR/new
/# End of rule
" $PM
# End of rule
"
echo "$filter" >> $PM
else
filter=$(echo "# Email rule for $MAILINGLIST subject [$SUBJECTTAG]\n:0\n * ^Subject:.*()\\\[$SUBJECTTAG\\\]\n$LISTDIR/new\n# End of rule\n")
sed "/# encrypt/i ${filter}" $PM
fi
chown $MYUSERNAME:$MYUSERNAME $PM
fi
if [ ! -f "$MUTTRC" ]; then