Parse Jakarta Mail Message objects into Clojure maps.
This is the core of the library: robust handling of MIME multipart messages, encoded headers, attachments, and charset variations.
Parse Jakarta Mail Message objects into Clojure maps. This is the core of the library: robust handling of MIME multipart messages, encoded headers, attachments, and charset variations.
(assoc-imap-id m)Add the stable :id key to an IMAP message map. The IMAP backend's
stable id is the UID as a string. No-op when :uid is absent.
Add the stable `:id` key to an IMAP message map. The IMAP backend's stable id is the UID as a string. No-op when `:uid` is absent.
(message->map msg)(message->map msg
{:keys [headers? body? attachments?]
:or {headers? true body? true attachments? true}})Convert a Jakarta Mail Message into a Clojure map.
Returns a map with keys: :uid - IMAP UID (long, or nil if unavailable) :message-id - Message-ID header :message-number - sequence number in folder (backend may dissoc this) :size - message size in bytes (-1 if unknown); the Maildir backend overrides it with the file length
The backend adds :id (a stable string identifier) after parsing:
UID-as-string for IMAP, filename prefix for Maildir.
:from - vector of {:name :address} maps
:to - vector of {:name :address} maps
:cc - vector of {:name :address} maps
:bcc - vector of {:name :address} maps
:reply-to - vector of {:name :address} maps
:subject - decoded subject string
:date-sent - java.util.Date
:date-received - java.util.Date
:content-type - raw content-type string
:body - map with :text, :html, and :attachments
:headers - map of all headers
:flags - set of keyword flags (:seen :answered :flagged :deleted :draft :recent)
Options (optional second argument): :headers? - include all headers (default: true) :body? - parse body content (default: true) :attachments? - include attachment data (default: true)
Example: (message->map msg) (message->map msg {:headers? false :attachments? false})
Convert a Jakarta Mail Message into a Clojure map.
Returns a map with keys:
:uid - IMAP UID (long, or nil if unavailable)
:message-id - Message-ID header
:message-number - sequence number in folder (backend may dissoc this)
:size - message size in bytes (-1 if unknown); the Maildir
backend overrides it with the file length
The backend adds `:id` (a stable string identifier) after parsing:
UID-as-string for IMAP, filename prefix for Maildir.
:from - vector of {:name :address} maps
:to - vector of {:name :address} maps
:cc - vector of {:name :address} maps
:bcc - vector of {:name :address} maps
:reply-to - vector of {:name :address} maps
:subject - decoded subject string
:date-sent - java.util.Date
:date-received - java.util.Date
:content-type - raw content-type string
:body - map with :text, :html, and :attachments
:headers - map of all headers
:flags - set of keyword flags (:seen :answered :flagged :deleted :draft :recent)
Options (optional second argument):
:headers? - include all headers (default: true)
:body? - parse body content (default: true)
:attachments? - include attachment data (default: true)
Example:
(message->map msg)
(message->map msg {:headers? false :attachments? false})cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |