diff --git a/changelogs/fragments/7303-mail-incorrect-header-parsing.yml b/changelogs/fragments/7303-mail-incorrect-header-parsing.yml new file mode 100644 index 0000000000..a35f5288d7 --- /dev/null +++ b/changelogs/fragments/7303-mail-incorrect-header-parsing.yml @@ -0,0 +1,2 @@ +bugfixes: + - mail - skip headers containing equals characters due to missing ``maxsplit`` on header key/value parsing (https://github.com/ansible-collections/community.general/pull/7303). diff --git a/plugins/modules/mail.py b/plugins/modules/mail.py index feaac69233..153eb9ed68 100644 --- a/plugins/modules/mail.py +++ b/plugins/modules/mail.py @@ -354,7 +354,7 @@ def main(): # NOTE: Backward compatible with old syntax using '|' as delimiter for hdr in [x.strip() for x in header.split('|')]: try: - h_key, h_val = hdr.split('=') + h_key, h_val = hdr.split('=', 1) h_val = to_native(Header(h_val, charset)) msg.add_header(h_key, h_val) except Exception: