From: James Gray Date: 2008-12-15T08:33:52+09:00 Subject: Re: email structure On Dec 14, 2008, at 5:20 AM, Adam Akhtar wrote: > can tmail do this parsing for me, dont really want to reinvent the > wheel. Sure can. > i looked in teh docs and did a bit of experimenting in irb but > coudnt find a way to specify if i wanted the whole body or just the > text > or html parts of it. I use some code like the following to find the text portion of a message in the Ruby gateway code: extract_text = lambda do |message_or_part| if message_or_part.multipart? message_or_part.each_part { |part| extract_text[part] } elsif message_or_part.content_type == "text/plain" # use message_or_part here… end end extract_text[message] Hope that helps. James Edward Gray II