Macro | Package: net.post-office | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.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-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version