On Feb 14, 2007, at 14:20, barjunk wrote:
> On Feb 14, 10:32 am, Eric Hodel <drbr... / segment7.net> wrote:
>> On Feb 14, 2007, at 10:05, barjunk wrote:
>>> Being new to ruby, I'm having a little trouble getting my mind  
>>> around
>>> the documentation for net/imap, located here:
>>>
>>> http://www.ruby-doc.org/stdlib/libdoc/net/imap/rdoc/index.html
>>>
>>> I understand that if I do:
>>>
>>> messagestruct = imap.uid_fetch(10,["BODYSTRUCTURE"])[0]
>>>
>>> I will get a FetchData object and further processing, like:
>>>
>>> message = messagestruct.attr["BODYSTRUCTURE"].parts[0].subtype
>>>
>>> would provide me the type of message (Plain, Html, etc) part 0 is.
>>>
>>> But I don't get what I'm 'doing'.  What words would describe the  
>>> above
>>> commands?
>>
>> You'll have to pass the message through a library like TMail to do
>> further processing on the body.
>
> Thanks for that....the thing is, its not very clear to me, by reading
> the docs provided, how those message objects are "organized".
>
> How does one use the documentation provided, along with some
> guesswork, about what the different objects "look" like?

There's two pieces, RFC 3501:

http://www.rfc-editor.org/rfc/rfc3501.txt

and Net::IMAP docs, particularly fetch:

$ ri Net::IMAP.fetch
-------------------------------------------------------- Net::IMAP#fetch
      fetch(set, attr)
------------------------------------------------------------------------
      Sends a FETCH command to retrieve data associated with a message
      in the mailbox. The set parameter is a number or an array of
      numbers or a Range object. The number is a message sequence
      number. attr is a list of attributes to fetch; see the
      documentation for Net::IMAP::FetchData for a list of valid
      attributes. The return value is an array of Net::IMAP::FetchData.
      For example:

        p imap.fetch(6..8, "UID")
        #=> [#<Net::IMAP::FetchData seqno=6, attr={"UID"=>98}>, \
             #<Net::IMAP::FetchData seqno=7, attr={"UID"=>99}>, \
             #<Net::IMAP::FetchData seqno=8, attr={"UID"=>100}>]
        p imap.fetch(6, "BODY[HEADER.FIELDS (SUBJECT)]")
        #=> [#<Net::IMAP::FetchData seqno=6, attr={"BODY 
[HEADER.FIELDS (SUBJECT)]"=>"Subject: test\r\n\r\n"}>]
        data = imap.uid_fetch(98, ["RFC822.SIZE", "INTERNALDATE"])[0]
        p data.seqno
        #=> 6
        p data.attr["RFC822.SIZE"]
        #=> 611
        p data.attr["INTERNALDATE"]
        #=> "12-Oct-2000 22:40:59 +0900"
        p data.attr["UID"]
        #=> 98

> Maybe this is just too broad of a question and as I run into issues, I
> should just ask specific questions about how to solve a specific
> problem....

Well, the ri has been immensely helpful to me in writing IMAPCleanse.

> This is where I see the adopt-a-newbie might come in handy.  I don't
> want to be told how to do it, just what things I should be considering
> as I read through the docs.  Experience will fill in the gaps...it
> would be nice if it included experience of others. :)

What are you building?