From jb at joergbattermann.com Sat May 10 08:56:54 2008 From: jb at joergbattermann.com (=?ISO-8859-1?Q?J=F6rg_Battermann?=) Date: Sat, 10 May 2008 14:56:54 +0200 Subject: [Tmail-talk] email body: plain text vs html? Message-ID: <852E0951-6303-432C-BA8A-2B6AE4EAF6BD@joergbattermann.com> Good morning everyone, I was wondering whether there is any 'built-in' way in tmail to differentiate between the plaintext and the html part of a message's body? E.g. I want to prefer importing the html one if present and only the plain text one if no html one is present. Is there any elegant way to do this? Cheers and thanks, -J?rg From jb at joergbattermann.com Sat May 10 09:01:01 2008 From: jb at joergbattermann.com (=?ISO-8859-1?Q?J=F6rg_Battermann?=) Date: Sat, 10 May 2008 15:01:01 +0200 Subject: [Tmail-talk] Empty body for multipart/signed Message-ID: Oh and a second question: whenever I try parsing mails which have been signed (e.g. like this one), I can see the mail's body just fine using tmail_mail_instance.to_s , but the .body part is empty. Is there some way to also get these mails' body properly? Cheers and thanks, -J From raasdnil at gmail.com Sat May 10 09:50:43 2008 From: raasdnil at gmail.com (Mikel Lindsaar) Date: Sat, 10 May 2008 23:50:43 +1000 Subject: [Tmail-talk] email body: plain text vs html? In-Reply-To: <852E0951-6303-432C-BA8A-2B6AE4EAF6BD@joergbattermann.com> References: <852E0951-6303-432C-BA8A-2B6AE4EAF6BD@joergbattermann.com> Message-ID: <57a815bf0805100650s5a1553d6gd2b0bfd6e8f091a0@mail.gmail.com> On Sat, May 10, 2008 at 10:56 PM, J?rg Battermann wrote: > I was wondering whether there is any 'built-in' way in tmail to differentiate > between the plaintext and the html part of a message's body? Yup, 'content_type' > Is there any elegant way to do this? Don't know about elegant, but try this: irb(main):017:0> mail = TMail::Mail.load('html_email') => # bodyport=nil> irb(main):018:0> mail.parts.each { |p| puts p.content_type } text/plain text/html => [# bodyport=nil>, # bodyport=nil>] Then you can decide what to do depending on the value of content_type. Mikel From raasdnil at gmail.com Sat May 10 09:53:56 2008 From: raasdnil at gmail.com (Mikel Lindsaar) Date: Sat, 10 May 2008 23:53:56 +1000 Subject: [Tmail-talk] Empty body for multipart/signed In-Reply-To: References: Message-ID: <57a815bf0805100653m549a5c4y42489da20aa3e573@mail.gmail.com> On Sat, May 10, 2008 at 11:01 PM, J?rg Battermann wrote: > whenever I try parsing mails which have been signed (e.g. like this one), I > can see the mail's body just fine using tmail_mail_instance.to_s , but the > .body part is empty. Is there some way to also get these mails' body > properly? I can't reproduce this problem. Please file a ticket at tmail.rubyforge.org with a test case and email so I can tell what is going on. Mikel From jb at joergbattermann.com Sat May 10 10:04:49 2008 From: jb at joergbattermann.com (=?ISO-8859-1?Q?J=F6rg_Battermann?=) Date: Sat, 10 May 2008 16:04:49 +0200 Subject: [Tmail-talk] email body: plain text vs html? In-Reply-To: <57a815bf0805100650s5a1553d6gd2b0bfd6e8f091a0@mail.gmail.com> References: <852E0951-6303-432C-BA8A-2B6AE4EAF6BD@joergbattermann.com> <57a815bf0805100650s5a1553d6gd2b0bfd6e8f091a0@mail.gmail.com> Message-ID: <5DF67151-5401-4A3A-A9F9-2886930C8F8D@joergbattermann.com> ahhh great, thanks! -J On May 10, 2008, at 3:50 PM, Mikel Lindsaar wrote: > On Sat, May 10, 2008 at 10:56 PM, J?rg Battermann > wrote: >> I was wondering whether there is any 'built-in' way in tmail to >> differentiate >> between the plaintext and the html part of a message's body? > > Yup, 'content_type' > >> Is there any elegant way to do this? > > Don't know about elegant, but try this: > > irb(main):017:0> mail = TMail::Mail.load('html_email') > => # bodyport=nil> > irb(main):018:0> mail.parts.each { |p| puts p.content_type } > text/plain > text/html > => [# bodyport=nil>, > # bodyport=nil>] > > Then you can decide what to do depending on the value of content_type. > > Mikel > _______________________________________________ > Tmail-talk mailing list > Tmail-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/tmail-talk -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available URL: