MacroPackage: net.post-officeToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1.
8.0 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-2009, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.1. This page was not revised from the 8.0 page.
Created 2009.7.29.

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