diff --git a/FAQ b/FAQ index babab36..a32925b 100644 --- a/FAQ +++ b/FAQ @@ -102,3 +102,11 @@ See the SECURITY section of metche(8). You might also be interested in Schleuder (http://schleuder.nadir.org/). +10. Why am I receiving metche reports as attachments with + Content-Type: application/octet-stream? + + You are probably using heirloom-mailx as /usr/bin/mail. That program's + charset conversion features depend on the current locale. You may + either switch to bsd-mailx or set the LOCALE variable in metche.conf to + something better suited than "C" to the charset(s) used in the Changelog + and other monitored files. diff --git a/metche b/metche index 1bfccde..617ef32 100755 --- a/metche +++ b/metche @@ -71,15 +71,34 @@ fi } +add_header() { + local subject="$1" + echo "Subject: $subject" + echo "To: $EMAIL_ADDRESS" + echo + cat +} + +_mail() { + local subject="$1" + if which mutt > /dev/null ; then + LC_ALL="$LOCALE" mutt -s "$subject" "$EMAIL_ADDRESS" + elif which mail > /dev/null ; then + LC_ALL="$LOCALE" mail -s "$subject" "$EMAIL_ADDRESS" + elif [ -x /usr/sbin/sendmail ]; then + LC_ALL="$LOCALE" add_header "$subject"|/usr/sbin/sendmail "$EMAIL_ADDRESS" + fi +} + email() { debug "* email $@ to $EMAIL_ADDRESS" local subject="`current_system` - $_MAIL_SUBJECT : $1" if [ $ENCRYPT_EMAIL = "yes" ]; then LC_ALL="$LOCALE" gpg --batch --armor --encrypt \ --recipient "$EMAIL_ADDRESS" | - LC_ALL="$LOCALE" mutt -s "$subject" "$EMAIL_ADDRESS" + LC_ALL="$LOCALE" _mail "$subject" else - LC_ALL="$LOCALE" mutt -s "$subject" "$EMAIL_ADDRESS" + LC_ALL="$LOCALE" _mail "$subject" fi }