As part of a script, I want to take a file containing an email and extract a header, e.g., the subject header. The following almost works:
formail -c -x subject < FILE
But it does not decode headers encoded using the MIME encoded-word syntax (aka RFC2047), e.g., =?UTF-8?B?w6lsw6ltZW50?=
.
What's a nice way to extract an email header while taking care of decoding MIME encoded-word parts?
Related question: https://stackoverflow.com/questions/39457380/retrieve-email-subject-from-file-via-bash
munpack
can help. linux.die.net/man/1/munpack – nobody Nov 23 '19 at 16:16munpack
seems to be about decoding MIME parts of messages, not headers. – a3nm Nov 23 '19 at 16:34