Invalid Content-Type header when body contains html

Created on 7 June 2022, almost 3 years ago
Updated 7 February 2024, about 1 year ago

Problem/Motivation

The Content-Type header sometimes contains a trailing semicolon which is inconsistent and potentially bad.

My motivation for this comes from the content-type header breaking the phpmailer_smtp module as it decodes of the Content-Type header. This happens because it is exploding the header on semi-colon and then inserting an extra/invalid "=" from the trailing semicolon.

Why am I submitting this here you might ask? According to a sourceless random unrelated github issue the MIME standard Content-Type header should not end with a trailing semicolon. It also fails msglint linting with it expecting an additional parameter.

I couldn't actually find this anywhere in the MIME standard documentation but all the examples I looked at don't end in a semicolon so it seems reasonable to me and solves my problem. Additionally, when there is an html body field present there is a semicolon at the end of the Content-Type header declaration but it is not present on the plain text body version. So, at the very least, I think it should be consistent.

Proposed resolution

Remove the trailing semi-colon from the two offending Content-Type declarations. I am providing a patch from the current 8.x-1.x branch.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States nrogers

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024