MacroPackage: net.post-officeToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version

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-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.1 page.
Created 2010.1.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version