Minijinja parsing fails on quoted-printable encoded message content

When injecting a message via the HTTP API using the content parameter (as a full RFC822 string), the request fails with an HTTP 500 error if the message body is quoted-printable encoded and contains minijinja templates.

The template renderer seems to be parsing the raw encoded string before it’s decoded, causing syntax errors when a template tag is split by a quoted-printable soft line break.

  • Create a full RFC822-compliant message string.
  • Ensure the message body uses Content-Transfer-Encoding: quoted-printable.
  • Ensure the message body contains minijinja template syntax (e.g., {{ first_name }}).
  • Ensure the message generation process (to enforce line length limits) creates a soft line break (ending in =) in the middle of a template tag.
  • Send this message string as the content parameter to the HTTP API injection endpoint.

The API responds with an HTTP 500 error, the log shows:

Error: syntax error: unexpected =, expected end of variable block (in 0:121)

This error corresponds to the quoted-printable encoded content. For example, a template variable {{ first_name }} is split and encoded as:

121 le;color:#374151;margin:0 0 20px 0">Hi  {% if first_name %}{{ first=
122 _name }}{% else %}there{% endif %},</p><p style=3D"font-size:15px;l=

The parser reads {{ first= and fails, as it doesn’t recognize the = as a quoted-printable line break.

Not quite sure if there’s something I can do on my side (while generating the HTTP injection payload) to prevent this or if this needs to be fixed on the Kumo side, happy to provide the full payload if that helps with debugging this.

Sounds like it needs to work the quoted printable before the templating. I can see where this may be an edge case, can you open an issue for it so @free-spirited-yorksh can review?

Sure, I’ll create an issue on Github

https://docs.kumomta.com/reference/http/api_inject_v1/#content says:

If a simple string is provided, it must be an RFC822 compliant message. If template substitutions are used in the request, then the entire RFC822 message string is used as-is for the template; no message parsing or decoding is performed as part of template expansion.

You need to send the message without Content-Transfer-Encoding.

After template expansion is performed, the content will be parsed and rebuilt and have transfer encoding applied as needed