[mel-base-devel] maildir multipart
Timothy Ritchey
tritchey at mac.com
Fri May 15 15:13:05 UTC 2009
If I do something like:
(defun check-email ()
(let* ((folder (mel:make-imaps-folder :host
"imap.gmail.com" :username "XXXXX" :password "XXXXX"))
(messages (mel:messages folder)))
(dolist (m messages)
(format t "~a~%" (find-plain-text m))) folder))
I am able to find the plain text part of the messages using:
(defun find-plain-text (message)
(let ((parts (mel:parts message))
(body "Unable to process email contents"))
(dolist (p parts)
(multiple-value-bind (a b) (mel:content-type p)
(if (and (equal a :TEXT) (equal b :PLAIN))
(let ((b (mel:part-body-string p))
(encoding (mel:content-transfer-encoding p)))
(if (string-equal encoding "quoted-printable")
(setf body (mel:decode-quoted-printable b))
(setf body b)))
(progn
(when (and (equal a :MULTIPART) (equal b :ALTERNATIVE))
(find-plain-text p))))))
body))
but if I try to move things over to a maildir, and run from there, my
FIND-PLAIN-TEXT function doesn't work. Is the maildir message format
different than a message in an imap folder?
(defun check-email ()
(let* ((folder (mel:make-imaps-folder :host
"imap.gmail.com" :username "XXXXX" :password "XXXXX"))
(tmp-folder (mel:make-maildir-folder "/tmp/test-maildir/" :if-does-
not-exist :create)))
(mel:move-folder folder tmp-folder)
(mel:map-messages
(lambda (m)
(let ((body (find-plain-text m)))
(format t "~a~%" body)))
tmp-folder)))
More information about the mel-base-devel
mailing list