[mel-base-devel] Hints about "idiomatic" use?
Jochen Schmidt
js at codeartist.org
Mon Nov 20 18:15:32 UTC 2006
Matthieu Villeneuve wrote:
> So far I have a POP3 folder, and a kind of "send/receive" command
> that fetches all messages from that folder, using the MEL:MESSAGES
> function. I can already see the message headers correctly positioned.
> Does that look like the right way to start?
If you want to use POP3, then I would fetch all remote messages using
COPY-FOLDER from the POP3
folder to a local Maildir-Folder. If you want, you can use MOVE-
FOLDER to move instead of copy the
messages. You can use MEL:MESSAGES if you want to display what
messages are there without
actually fetching the messages. The headers will get loaded on demand
if you access a header field
of a message. If you do access header data in bulk (for example
accessing the "From" header-field on all messages)
there is the function ENSURE-HEADERS-READ to ensure all headers are
available locally before accessing them.
> Once this is done, it looks like a message can be either a
> MEL:RFC2822-BASIC-MESSAGE, or a MEL:MIME-MESSAGE. In both cases, is
> there a simple way to get the message body?
You can use MEL:PARTS to get a list of the MIME-Parts of the message.
The body of a part can get accessed
using MEL:PART-BODY-STRING (or MEL:PART-BODY-STREAM if you want a
stream). If you just want
the body of the message without taking MIME-Parts into account - you
can just use MEL:MESSAGE-BODY-STREAM to access the complete body of
the message.
But: If you wanted to know how to fetch the body so that you can copy
a remote messages body into a local mail-store: Don't do that - just
use COPY-FOLDER and copy the whole message.
ciao,
Jochen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/mel-base-devel/attachments/20061120/bb1f007c/attachment.html>
More information about the mel-base-devel
mailing list