Support more mailers than just mutt.
Thanks to Kan-Ru Chen <koster@debian.org> for the patch.
intrigeri
12 years ago
70 | 70 | fi |
71 | 71 | } |
72 | 72 | |
73 | add_header() { | |
74 | local subject="$1"; | |
75 | echo "Subject: $subject"; | |
76 | echo "To: $EMAIL_ADDRESS"; | |
77 | echo | |
78 | cat; | |
79 | } | |
80 | ||
81 | _mail() { | |
82 | local subject="$1"; | |
83 | if which mail > /dev/null ; then | |
84 | LC_ALL="$LOCALE" mail -s "$subject" "$EMAIL_ADDRESS" | |
85 | elif [ -x /usr/sbin/sendmail ]; then | |
86 | LC_ALL="$LOCALE" add_header "$subject"|/usr/sbin/sendmail "$EMAIL_ADDRESS" | |
87 | elif which mutt > /dev/null ; then | |
88 | LC_ALL="$LOCALE" mutt -s "$subject" "$EMAIL_ADDRESS" | |
89 | fi | |
90 | } | |
91 | ||
73 | 92 | email() { |
74 | 93 | debug "* email $@ to $EMAIL_ADDRESS" |
75 | 94 | local subject="`current_system` - $_MAIL_SUBJECT : $1" |
76 | 95 | if [ $ENCRYPT_EMAIL = "yes" ]; then |
77 | 96 | LC_ALL="$LOCALE" gpg --batch --armor --encrypt \ |
78 | 97 | --recipient "$EMAIL_ADDRESS" | |
79 | LC_ALL="$LOCALE" mutt -s "$subject" "$EMAIL_ADDRESS" | |
98 | LC_ALL="$LOCALE" _mail "$subject" | |
80 | 99 | else |
81 | LC_ALL="$LOCALE" mutt -s "$subject" "$EMAIL_ADDRESS" | |
100 | LC_ALL="$LOCALE" _mail "$subject" | |
82 | 101 | fi |
83 | 102 | } |
84 | 103 |