Macro | Package: net.post-office | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 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-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version