Last active
August 25, 2022 18:33
-
-
Save bmatthewshea/b255322256b4daebd32f2b207e58b3c5 to your computer and use it in GitHub Desktop.
Spamassassin - Command Line Test Email
This file contains hidden or 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 | |
def_filename="test.eml" | |
tmp1="/tmp/emailresults.txt" | |
tmp2="/tmp/emailresults.log" | |
usage=" | |
$(basename "$0") [-h] [mailmessage] | |
Send email through Spamassassin manually and view output | |
Flags: | |
-h Show this help | |
mailmessage Filename of the email to be tested (default: ./${def_filename}) | |
" | |
# test user data: | |
if [ "$1" == "-h" ] || [ "$1" == "" ] ; then | |
printf "$usage" | |
exit 0 | |
fi | |
if ! test -f "$1" ; then | |
printf "\n \"${1}\" not found. Exiting.\n\n" | |
exit 0 | |
fi | |
# execute: | |
( spamassassin -D < $1 2>&1 > "$tmp1" ) > "$tmp2" | |
# display results | |
#show results | |
less "$tmp1" | |
#show sa log | |
less "$tmp2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment