Is there an XML/DSL way to replace the message body with an
attachment? In particular, I'm dealing with e-mail messages that each
come with an Excel attachment. The body is throwaway, I only care
about the attachment. So I'd like to have some option to overwrite
the body with the attachment.
One problem is that the attachments seem to be indexed by name not by
number or position... But in this case I'm confident I just want the
first/only one. I could also imagine wanting "the attachment with
MIME type XYZ" or whatever. If there are zero or many matching
attachments, I'd be happy to get an error.
Trivial with a POJO, but it would be nice not to need one. :)