I am using the following code to get make an IMAP connection. I am want to read emails. I read this documentation
link
and could not proceed from here.
my code:
#lang racket
(define imap-server "*****")
(define imap-port-no ***)
(define username "*****")
(define pw "*****")
(define mailbox-name "INBOX")
(require openssl/mzssl
net/imap
mzlib/etc)
(define (test-connect)
(let ([c (ssl-make-client-context)])
(let-values ([(in out) (ssl-connect imap-server imap-port-no c)])
(imap-connect* in out username pw mailbox-name))))
(define-values (imap cnt recent) (test-connect))
I am getting the count of emails and count of recent mails from this. How to proceed from here. which functions i should call to read emails.
Thanks in advance.
Try something like this:
This should return a list holding the “fields” described by the flags, where
headergives you the complete header part, andbodyis the email body. (This is just a quick experiment to see that things are working, you’ll need to know which messages to retrieve, etc — all described in the documentation.)Here’s a complete program that returns a list of the headers you want for each message in the INBOX, where each message gets an alist of the headers and their values as strings. But note that email is not really reliable for such things — you can receive a message regardless of what appears in the
To:field, and there are many other header with similar semantics (for example,Resent-To:is similar toTo:, sometimes there’s aSender:header that can be more reliable thanFrom:, etc.).