StackStorm-Exchange / stackstorm-email

E-Mail Actions/Sensors for StackStorm
https://exchange.stackstorm.org/
Apache License 2.0
9 stars 45 forks source link

Adjust email_to data type to fix multiple destinations support. #5

Closed nzlosh closed 7 years ago

nzlosh commented 7 years ago

Problem Stackstorm only sends an email to the first address when attempting to send to multiple destinations.

Reason The pack passes the variable email_to in the form of a string to the Python code. The Python code uses smtplib which treats string types as a single address. smtplib can process multiple addresses if they are supplied in the form of a list. So passing email_to as a string doesn't produce errors, but silent fails for multiple destinations.

The Python code also uses MIMEMultipart which calls string methods directly on email_to. If email_to is a list, it causes exceptions to be raised.

Solution By changing the data type from email_to to array, the field better reflects the multiple addresses nature and makes processing the address list simple and unambiguous.

While this is a breaking change, I hope this patch will be accepted as the better solution for the long term.

LindsayHill commented 7 years ago

Cool, this came up as a missing piece a few months ago.

Could you update CHANGES.md, and the version in pack.yaml, and then we can merge it?

nzlosh commented 7 years ago

Thanks @LindsayHill, I've updated the pack version and changelog as requested.