diff --git a/config/neomutt/extract-reply.sh b/config/neomutt/extract-reply.sh index d2dd9bc..010664e 100755 --- a/config/neomutt/extract-reply.sh +++ b/config/neomutt/extract-reply.sh @@ -4,7 +4,40 @@ set -euo pipefail text="$(cat)" -# Extract only the text/html part of the multipart email +# The Mime Format emails we're trying to parse have the following layout +# +# To: mail@example.org +# ... +# +# Content-Type: multipart/mixed; +# boundary="=_c4f4c8bf54a05b2b47ef558c3c61e418" +# ... +# +# This is a message in Mime Format. If you see this, your mail reader does not support this format. +# +# --=_c4f4c8bf54a05b2b47ef558c3c61e418 +# Content-Type: multipart/alternative; +# boundary="=_935b3ef6db1361fbfde9e3eb2b1debe5" +# Content-Transfer-Encoding: 8bit +# +# +# --=_935b3ef6db1361fbfde9e3eb2b1debe5 +# Content-Type: text/plain; charset=iso-8859-1 +# Content-Transfer-Encoding: quoted-printable +# +# ... +# +# --=_935b3ef6db1361fbfde9e3eb2b1debe5 +# Content-Type: text/html; charset=iso-8859-1 +# Content-Transfer-Encoding: quoted-printable +# +# =0A =0A =09=0A +# ... +# --=_c4f4c8bf54a05b2b47ef558c3c61e418-- + +# We're only interested in the text/html part of the multipart email # TODO parse actual encoding instead of defaulting to iso-8859-1 mailto="$(printf "%s" "$text" \ | awk '