INT-4098: IMAP Content Rendering Consistency

JIRA: https://jira.spring.io/browse/INT-4098

Polishing - What's New

Schema Polishing

Also fix a test to align it with changes to the test mail server.
This commit is contained in:
Gary Russell
2016-08-17 16:45:35 -04:00
committed by Artem Bilan
parent 76bb3ada32
commit dfb6ab1e08
14 changed files with 178 additions and 7 deletions

View File

@@ -55,6 +55,31 @@ Spring Integration provides the `ImapIdleChannelAdapter` which is itself a Messa
It delegates to an instance of the `ImapMailReceiver` but enables asynchronous reception of Mail Messages.
There are examples in the next section of configuring both types of inbound Channel Adapter with Spring Integration's namespace support in the 'mail' schema.
[[imap-format-important]]
[IMPORTANT]
====
Normally, when `IMAPMessage.getContent()` method is called, certain headers as well as the body are rendered (for a simple text email):
[source]
----
To: foo@bar
From: bar@baz
Subject: Test Email
foo
----
With a simple `MimeMessage`, `getContent()` just returns the mail body (`foo` in this case).
Starting with _version 2.2_, the framework eagerly fetches IMAP messages and exposes them as an internal subclass of `MimeMessage`.
This had the undesired side effect of changing the `getContent()` behavior.
This inconsistency was further exacerbated by the <<mail-mapping, Mail Mapping>> enhancement in _version 4.3_ in that, when a header mapper was provided, the payload was rendered by the `IMAPMessage.getContent()` method.
This meant that IMAP content differed depending on whether or not a header mapper was provided.
Starting with _version 5.0_, messages originating from an IMAP source will now render the content in accordance with `IMAPMessage.getContent()` behavior, regardless of whether a header mapper is provided.
If you are not using a header mapper, and you wish to revert to the previous behavior of just rendering the body, set the `simpleContent` boolean property on the mail receiver to `true`.
This property now controls the rendering regardless of whether a header mapper is used; it now allows the simple body-only rendering when a header mapper is provided.
====
[[mail-mapping]]
=== Inbound Mail Message Mapping

View File

@@ -28,3 +28,8 @@ The gateway now correctly sets the `errorChannel` header when the gateway method
Previously, the header was not populated.
This had the effect that synchronous downstream flows (running on the calling thread) would send the exception to the configured channel but an exception on an async downstream flow would be sent to the default `errorChannel` instead.
See <<gateway-error-handling>> for more information.
==== Mail Changes
Some inconsistencies with rendering IMAP mail content have been resolved.
See <<imap-format-important, the note in the Mail-Receiving Channel Adapter Section>> for more information.