Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-4097

PoorMansMailServer.ImapServer doesn't provide a proper IMAPMessage when HeaderMapper is provided for adapter

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 4.3.1
    • Fix Version/s: 4.3.2
    • Component/s: Mail Support
    • Labels:

      Description

      When we don't provide HeaderMapper to the ImapIdleChannelAdapter (for example), an internal transformation is applied to the MimeMessage - IntegrationMimeMessage.

      With the HeaderMapper we end up with this results after target receiving:

      payload = "To: [email protected]\r\nFrom: [email protected]\r\nSubject: Test Email\r\n\r\nfoo\r\n"
      headers = {[email protected]}  size = 16
      ...
       1 = {Col[email protected]1949} "mail_to" -> 
        key = "mail_to"
        value = {String[1]@1969} 
         0 = "Bar <[email protected]>"
      ...
       5 = {Col[email protected]1953} "mail_from" -> "Foo <[email protected]>"
        key = "mail_from"
        value = "Foo <[email protected]>"
      

      POP3 works well. That's why I assume that we have something wrong in the ImapServer.doRun().

      The simplest way to reproduce is ImapMailReceiverTests.testIdleWithMessageMapping() and additional asserts in the code block:

      else {
      	org.springframework.messaging.Message<?> received = channel.receive(10000);
      	assertNotNull(received);
      	assertNotNull(received.getHeaders().get(MailHeaders.RAW_HEADERS));
      	assertThat((String) received.getHeaders().get(MailHeaders.CONTENT_TYPE),
      			equalTo("TEXT/PLAIN; charset=ISO-8859-1"));
      	assertThat((String) received.getHeaders().get(MessageHeaders.CONTENT_TYPE),
      			equalTo("TEXT/PLAIN; charset=ISO-8859-1"));
      }
      

      for expected FROM, TO and payload.

        Attachments

          Activity

            People

            Assignee:
            grussell Gary Russell
            Reporter:
            abilan Artem Bilan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: