porte encode_rfc2047 from nmh
[mmh] / uip / mhbuild.c
index 140cfdb..d636cf7 100644 (file)
@@ -411,6 +411,18 @@ finish_field:
        }
 
        /*
+        * Iterate through the list of headers and call the function to MIME-ify
+        * them if required.
+        */
+
+       HF hp;
+       for (hp = ct->c_first_hf; hp != NULL; hp = hp->next) {
+               if (encode_rfc2047(hp->name, &hp->value, NULL)) {
+                       adios(EX_DATAERR, NULL, "Unable to encode header \"%s\"", hp->name);
+               }
+       }
+
+       /*
        ** Now add the MIME-Version header field
        ** to the list of header fields.
        */
@@ -1529,6 +1541,9 @@ build_headers(CT ct)
        if (ct->c_descr) {
                np = getcpy(DESCR_FIELD);
                vp = concat(" ", ct->c_descr, NULL);
+               if (encode_rfc2047(DESCR_FIELD, &vp, NULL)) {
+                       adios(EX_DATAERR, NULL, "Unable to encode %s header", DESCR_FIELD);
+               }
                add_header(ct, np, vp);
        }