문제

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 ?

도움이 되었습니까?

해결책

Here's the solution that I found:

 MimeBodyPart mbp = new MimeBodyPart();
 mbp.setContent(forwardedMsg, "message/rfc822");
 mp.addPart(mbp);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top