AIUI, we are supposed to use the shorter of quoted printable or base64
for utf-8 headers, so we try to decode the header into ascii, and if that
fails, we select the shorter encapsulation and use that in the template.
This change requires importing the module email, which also means changing
all the uses of the variable 'email' into emailaddr so we don't break
usage of the email module.