You are looking at historical revision 13621 of this page. It may differ significantly from its current revision.
Retrieve e-mails using the POP3 protocol (RFC1939).
Errors triggered by invalid or negative replies from the POP3 server are signalled by raising a compound condition of the kinds exn and pop3.[procedure] (pop3:connect HOSTNAME USERNAME PASSWORD [VERBOSE [PORT]])
Connects to the server HOSTNAME using the POP3 protocol and identifies this client with USERNAME and PASSWORD. If the optional argument VERBOSE is given and not #f, then a protocol of the communication with the server is written to the value of (current-error-port). PORT specifies the port-number and defaults to 110.
This procedure returns an object representing the POP3 session.[procedure] (pop3:disconnect POP3)
Closes the connection identified by the session object POP3.[procedure] (pop3:pop3? X)
Returns #t if X is an POP3 session object, or #f otherwise.[procedure] (pop3:list POP3)
Returns the list of all available messages as an a-list, where each element in the list is a pair of the form (MESSAGE-ID . SIZE) representing the message-identifier and the size of the message in bytes.[procedure] (pop3:open POP3 INDEX [DELETE])
Returns a port for the message with id INDEX and returns an input-port that can be used to retrieve the header and the contents of the message. If the optional argument DELETE is given and not #f, then the message will be deleted on the server, when the port is closed.
It is not possible to call pop3:open before the port returned by a previously invoked call has been closed.
; Download and print all messages: (define p (pop3:connect "pop3.your-isp.net" "myname" "secret")) (for-each (match-lambda [(id . bytes) (print "Retrieving message " id ", " bytes " bytes:") (let ([port (pop3:open p id)]) (display (read-string #f port)) (close-input-port port) ) ] ) (pop3:list p) ) (smtp:disconnect s)
- 1.2 Replaced use of (end-of-file) with #!eof
- 1.1 Fixed bug that caused an unbound variable error if connection failed.
Copyright (c) 2003, Felix L. Winkelmann All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.