Skip to content

core.sendmail action UTF-8/base64 encoding doesn't handle longer subject lines properly #4795

@stevemuskiewicz

Description

@stevemuskiewicz

SUMMARY

When using the core.sendmail action if the subject line is too long (approx 56 but apparently really depends on the line length of the base64 encoded text) then the encoding apparently line-wraps which in turn causes the formatting of the subject and the body of the message to get mangled.

STACKSTORM VERSION

Paste the output of st2 --version: st2 3.1.0, on Python 2.7.5

OS, environment, install method

RPM install on CentOS 7.7

Steps to reproduce the problem

st2 run core.sendmail from="st2 notifier <XXXXXX@plexxi.com>" to=XXXXXXXXX@plexxi.com body="<html><body><h2>Test message</h2>How does this end up getting formatted?<p>new line here</p></body></html>" subject="This is a subject line that is too long - it will get mangled"

Expected Results

HTML message with subject line: This is a subject line that is too long - it will get mangled and HTML formatted body

Actual Results

Actual email message headers/body look like this:

TO: XXXXXXXXX@plexxi.com
FROM: st2 notifier XXXXXX@plexxi.com
SUBJECT: =?UTF-8?B?>VGhpcyBpcyBhIHN1YmplY3QgbGluZSB0aGF0IGlzIHRvbyBsb25nIC0gaXQgd2lsbCBnZXQgbWFu
Message-Id: 20190930180507.XXXXXXXX@XXXXXXXX.plexxi.com
Date: Mon, 30 Sep 2019 14:05:07 -0400 (EDT)

Z2xlZAo=?=
Content-Type: text/html; charset=UTF-8

Test message

How does this end up getting formatted?

new line >here



This message was generated by StackStorm action send_mail running on XXXXXX.plexxi.com`

As you can see, the subject line apparently wrapper and flowed onto another line which resulted in a message that looked like this:

st2sendmail_bugreport

Shortening the subject line by a couple of characters causes everything to work properly and the HTML message is formatted as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions