mail-source file attachments (multipart email)
hi,
we are trying to use the mail-source application to download emails from our mail server and feed existing attachments into a stream. however, only a string of the complete email (with attachments) is transmitted in the mail-source component. is there a possibility to have the email parsed directly into a multipart email? or does this have to be implemented manually by the user?
thanks in advance regards, juergen
Correct. The current implementation of Mail Source does this unconditionally:
.transform(Mail.toStringTransformer(this.properties.getCharset()))
So, independently of the mail content we always try to convert it into a String.
It is not clear how you'd like to be streamed a multipart email downstream, so we leave such a complex task out of this project scope.
See if you can use MailReceivingMessageSource in your custom source implementation to emit a MimeMessage and deal with its attachment the way you'd like.
See more info in docs, too: https://docs.spring.io/spring-integration/docs/current/reference/html/mail.html#mail-mapping.
We are open for contribution back if you find the way to stream multipart email down in a common way.