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
> <jb at joergbattermann.com> 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'')
> => #<TMail::Mail port=#<TMail::FilePort:/html_email >
bodyport=nil>
> irb(main):018:0> mail.parts.each { |p| puts p.content_type }
> text/plain
> text/html
> => [#<TMail::Mail port=#<TMail::StringPort:id=0xa2995a>
bodyport=nil>,
> #<TMail::Mail port=#<TMail::StringPort:id=0xa298a6>
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:
<http://rubyforge.org/pipermail/tmail-talk/attachments/20080510/f139b4af/attachment.bin>