#!/bin/sh set -euo pipefail text="$(cat)" # Extract only the text/html part of the multipart email # TODO parse actual encoding instead of defaulting to iso-8859-1 mailto="$(printf "%s" "$text" \ | awk ' boundary { if ($0 ~ boundary) { boundary = ""; next } print $0 } /Content-Type: text\/html;/ { boundary=line } { line=$0 }' \ | qprint -d \ | iconv -f iso-8859-1 -t utf-8 \ | grep -Eo ' "$datadir/info.rc"