Kevin Bullock
11/22/2004 5:59:00 AM
It just so happens that I was working on a moblog (mobile blogging)
application this spring, and I used rmail to parse out the attachments.
I never got around to doing anything with multimedia attachments; my
script only parses out text sections and combines them. RMail seems to
work well for this, though. You would do something like:
msg = RMail::Parser.read( file_handle )
if msg.multipart?
msg.each_part do | part |
if part.header.media_type == 'image'
# decode image and write to directory
elsif part.header.media_type == 'text'
# add part.body to the text of your posting, however you're storing
it
end
end
end
Pacem in terris / Mir / Shanti / Salaam / Heiwa
Kevin R. Bullock
On Nov 21, 2004, at 7:08 PM, Phil Tomson wrote:
> What I want to do:
> I'm setting up a photo blog (probably using Hobix, but that's not
> final yet).
> I want to be able to send an email to a certain email address and have
> that email
> posted to the blog if it meets certain criteria. I also want to be
> able to
> attach photos to the email message. When the script finds that there
> are
> attached photos it should read those attachements, de-encode them and
> copy them
> to a specified photo directory.
>
> It would be great if someone already has a script for doing this sort
> of thing
> that they would be willing to share. If not, perhaps someone could
> point me in
> the right direction - which would be better for this: rubymail or
> TMail?
>
> Phil
>
>
> !DSPAM:41a13c1566013101614873!