reading POP mail headers
[1/2] from: gchiu::compkarori::co::nz at: 17-Sep-2002 8:37
The POP protocol allows for the retrieval of the mail
headers without having to download the whole message.
'import-email gets the headers, but has to retrieve the
whole message to do so.
Can one get just the headers from a POP mailbox?
--
Graham Chiu
[2/2] 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
]