I'm trying to implement some sort of spamreport for my Mail Server. Mails are sorted by sieve and are all in one folder called Spam. I loop through the folder with bash. With this i get the necessary informations from the mail:
cat $f | grep '^From' | head -n1 >> $TMPFILE
cat $f | grep '^Subject' | head -n1 >> $TMPFILE
but in some mails the subject is encoded like this
Subject: =?ISO-8859-1?Q?Test:_Jaguar_XKR-S:_Unter_dem_Blech_lauert_d?=
How i can get the subject in correct encoding? I tried to use mail, mailx, mutt... but no one was able to simply load a mail from file.