Prev: hibernate question ?
Next: 10 MAXIMO positions in Austin, TX.,- duration 6+ months - Interviews over Phone
From: Martin Gregorie on 12 Jun 2010 12:25 On Sat, 12 Jun 2010 11:43:15 -0400, Lew wrote: > You have a 'msg.getContent()' that returns that 'content'. I'll give it > credit for a declaration 'public InputStream getContent()'. > Actually, it returns an Object. Disassembling that is a recursive process, which you start by getting the body as a Part with MimeMessage.getContent(). Then you can inspect the Part's headers to determine what it is with MimeType and decide what you're going to do with it, such as write it to a file before using getContent() to get its content as an Object and then using the instanceof operator to determine what you got, which is normally one of: - String. Used for plain text - the headers give the encoding. - InputStream. This is used for binary and Base64 attachments. - MultiPart. Dissembling the message body is a recursive process: an attachment might be a MIME message with its own attachments. > There must be some action, not a declarative type cast, that you really > want to perform with that 'getContent()'. What is it? > If the OP had done what I said in the first place and read the JavaMail Design Specification he would already know this *and* would be in possession of example code that does exactly what I've just described. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
From: Lew on 13 Jun 2010 10:25 Martin Gregorie wrote: > - MultiPart. Dissembling the message body is a recursive process: Nit: "Disassembling", not "dissembling". "Dissembling" means "deceiving". -- Lew
From: Martin Gregorie on 13 Jun 2010 12:21 On Sun, 13 Jun 2010 10:25:23 -0400, Lew wrote: > Martin Gregorie wrote: >> - MultiPart. Dissembling the message body is a recursive process: > > Nit: "Disassembling", not "dissembling". "Dissembling" means > "deceiving". > Quite. I thought I written disassembling. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
From: Lothar Kimmeringer on 13 Jun 2010 16:14 eunever32(a)yahoo.co.uk wrote: > The full text of the email is as follows (I'm not storing the from, to > etc.) If you throw away the mail-headers, the parser is not able to recognize that the mail is a multipart message. So no wonder, you don't get wrong results. Regards, Lothar -- Lothar Kimmeringer E-Mail: spamfang(a)kimmeringer.de PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81) Always remember: The answer is forty-two, there can only be wrong questions!
From: eunever32 on 18 Jun 2010 06:45 On Jun 13, 9:14 pm, Lothar Kimmeringer <news200...(a)kimmeringer.de> wrote: > euneve...(a)yahoo.co.uk wrote: > > The full text of the email is as follows (I'm not storing the from, to > > etc.) > > If you throw away the mail-headers, the parser is not able to > recognize that the mail is a multipart message. So no wonder, > you don't get wrong results. > > Regards, Lothar > -- > Lothar Kimmeringer E-Mail: spamf...(a)kimmeringer.de > PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81) > > Always remember: The answer is forty-two, there can only be wrong > questions! For anyone else who encounters this issue I thought I would share the solution: I upgraded my version of Javamail to 1.4.3 ( I had been using 1.3)
First
|
Prev
|
Pages: 1 2 Prev: hibernate question ? Next: 10 MAXIMO positions in Austin, TX.,- duration 6+ months - Interviews over Phone |