Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: reading POP mail headers

From: greggirwin:mindspring at: 16-Sep-2002 16:21

Hi Graham, << Can one get just the headers from a POP mailbox? >> Far from my area of expertise, and hopefully an expert will chime in with a really nice solution, but I was able to pull some pieces out of the POP scheme and hack the following together, which seems to work. I just changed the read-message function to use TOP instead of RETR. The other stuff I just pulled to make it run outside the scheme context. --Gregg read-til-dot: func [port buf][ while [(line: system/words/pick port/sub-port 1) <> "."] [ insert tail buf line insert tail buf newline ] buf ] write-check: [none "+OK"] read-header: func [ "Read a message header from the POP server" port n [integer!] /local buf line ][ ; Last number (0) is number of body lines to retrieve. insert port/sub-port reform [ "TOP" system/words/pick port/locals/msg-nums port/state/index + n 0 ] net-utils/confirm port/sub-port write-check read-til-dot port buf: make string! 1024 ]