Re: encrypted javamail MimeMultipart
- From: "eunever32@xxxxxxxxxxx" <eunever32@xxxxxxxxxxx>
- Date: Fri, 11 Jun 2010 06:53:14 -0700 (PDT)
On Jun 11, 2:40 pm, "euneve...@xxxxxxxxxxx" <euneve...@xxxxxxxxxxx>
wrote:
On Jun 11, 1:06 pm, Martin Gregorie <mar...@xxxxxxxxxxxxxxxxxxxxxx>
wrote:
On Thu, 10 Jun 2010 19:04:36 -0700, Roedy Green wrote:
On Thu, 10 Jun 2010 02:04:40 -0700 (PDT), "euneve...@xxxxxxxxxxx"
<euneve...@xxxxxxxxxxx> wrote, quoted or indirectly quoted someone who
said :
How can I cast this to a MimeMultipart ?
I have not done this myself, but it seems to me you need four steps:
1. get the armoured encrypted message characters, with headers stripped
off.
2. strip off the armouring so you have an array of bytes.
3. run this through the decryption algorithm.
4. convert the decrypted bytes back into characters via some encoding..
(4) should become:
- create a ByteArrayInputStream from the decrypted byte array
- pass that to a MimeMessage constructor.
At this point you can use the standard MimeMessage and MultiPart
methods to parse the message and extract its content.
--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |- Hide quoted text -
- Show quoted text -
Thanks Martin but maybe you can help me:
As I said I'm new to this Javamail api and am looking for a succinct
way to obtain the attachment
I can do
MimeMessage msg = new MimeMessage(session, new
FileInputStream("file.txt"));
The resulting msg has three headers which looks right
But when I do
if (msg.getContent() instanceof Multipart) {
saveAttachment
}
It transpires it's NOT an object of type Multipart ... so what can I
do ???
I think at this stage it's basic javamail I require but am struggling.
Thanks.- Hide quoted text -
- Show quoted text -
In other words when I try this
Multipart multipart = (Multipart) content;
Exception in thread "main" java.lang.ClassCastException:
com.sun.mail.util.SharedByteArrayInputStream
.
- Follow-Ups:
- Re: encrypted javamail MimeMultipart
- From: Martin Gregorie
- Re: encrypted javamail MimeMultipart
- References:
- encrypted javamail MimeMultipart
- From: eunever32@xxxxxxxxxxx
- Re: encrypted javamail MimeMultipart
- From: Roedy Green
- Re: encrypted javamail MimeMultipart
- From: Martin Gregorie
- Re: encrypted javamail MimeMultipart
- From: eunever32@xxxxxxxxxxx
- encrypted javamail MimeMultipart
- Prev by Date: Re: encrypted javamail MimeMultipart
- Next by Date: javamail content not multipart
- Previous by thread: Re: encrypted javamail MimeMultipart
- Next by thread: Re: encrypted javamail MimeMultipart
- Index(es):
Relevant Pages
|