-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
In what version(s) of Spring Integration are you seeing this issue?
spring-integration-mail:5.4.5
Describe the bug
https://github.com/spring-projects/spring-integration/blob/main/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/MailUtils.java#L52 and https://github.com/spring-projects/spring-integration/blob/main/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/MailUtils.java#L56 expect a single address, and throw an exception org.springframework.messaging.MessagingException: conversion of MailMessage headers failed; nested exception is java.lang.IllegalStateException: expected a single value but received an Array
in https://github.com/spring-projects/spring-integration/blob/main/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/MailUtils.java#L69 while RFC 5322 https://tools.ietf.org/html/rfc5322#section-3.6.2 allows for a comma separated list of "mailbox specifications" (for from
) or "addresses" (for reply-to
). Messages that conform to RFC 5322 cannot be transformed successfully.
To Reproduce
This was just a find after an analysis of production log error messages when receiving mails. It should be reproducible with mail messages containing multiple values in the from
or reply-to
fields according to RFC 5322.
Expected behavior
from
and reply-to
header fields should support multiple comma-separated addresses, be extracted successfully and copied to the AbstractIntegrationMessageBuilder
at https://github.com/spring-projects/spring-integration/blob/main/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/AbstractMailMessageTransformer.java#L83
Inbound mail messages conforming to RFC 5322 should be transformable without throwing an exception. Currently, this leads to cases where we are not able to successfully receive RFC5322 conforming inbound mail.