MacroPackage: net.post-officeToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 7.0
This page is new in 7.0.

with-fetch-letter-sequence

Arguments: (mailbox &rest args) &body body

with-fetch-letter-sequence prepares for retrieval of a letter in a memory efficient manner. It is useful in cases where it is inefficient or impossible to store a letter in memory as a string. This macro is implemented for pop mailboxes only.

args are arguments suitable for a call to fetch-letter.

Within body, fetch-letter-sequence calls may be made to retrieve the first and subsequent chunks of text from the desired letter.

with-fetch-letter-sequence calls cannot be nested.

Example:

;; Download and save an arbitrarily large message into a file
;; for later processing.
(with-open-file (f "letterfile" :direction :output :if-does-not-exist :create)
  (with-pop-connection ("localhost" :user "joe" :password "secret")
    ;; download letter number 12
    (with-fetch-letter-sequence (mb 12)
      (let ((buffer (make-string 4096))
            endpos)
        (until (end-of-letter-p mb)
	  (setf endpos (fetch-letter-sequence mb buffer))
          (write-sequence buffer f :end endpos))))))

See also fetch-letter-sequence and end-of-letter-p.

See imap.htm for more information.


Copyright (c) 1998-2006, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 7.0. This page is new in the 7.0 release.
Created 2005.9.20.

ToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 7.0
This page is new in 7.0.