views:

10

answers:

1

Hello.

I've got a mailer daemon that check a box and fetch the mails inside every X mins. When an error occurs, I need to send a alert mail, with the faulty message as an attachment.

I dont want to create a file, write the content from the original message and then add the file to the error message, I want to directly set the MimeBodyPart content from the original stream. I already did this some years ago, so I know it's possible, I just can't remember the exact syntax to copy the message stream to the MimeBodyPart and set the content type ( which is RFC2822 )

Anyone can help ?

+1  A: 

MimeBodyPart mbp = new MimeBodyPart(); mbp.setContent(forwardedMsg, "message/rfc822"); mp.addPart(mbp);

Here I go.

Spark