Namespace: joker.mail
v1.0Contents
Summary
Parses raw RFC 5322 email messages, address fields, mail dates, and MIME email content.
Index
- parse-address
- parse-address-list
- parse-date
- read-attachments
- read-email
- read-message
- read-mime-message
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
(None.)
Functions, Macros, and Special Forms
-
parse-address
Function v1.8.1(parse-address s)(parse-address ^String s)Parses one RFC 5322 email address and returns
show types
{:name display-name :address mailbox}.
A missing display name is returned as an empty string. Throws Error when s
is not a valid address according to Go's net/mail parser. -
parse-address-list
Function v1.8.1(parse-address-list s)(parse-address-list ^String s)Parses an RFC 5322 address list and returns a vector of maps.
show types
Each element has the form {:name display-name :address mailbox}. Throws
Error when s is not a valid address list according to Go's net/mail parser. -
parse-date
Function v1.8.1(parse-date s)(parse-date ^String s)Parses an RFC 5322 date string and returns a Time.
show types
Throws Error when s is not a date accepted by Go's net/mail parser. -
read-attachments
Function v1.9.0(read-attachments source)(read-attachments ^Object source)(read-attachments source opts)(read-attachments ^Object source ^Map opts)Parses an RFC 5322 email message and returns its MIME attachments.
show types
Equivalent to calling joker.mime/attachments on read-mime-message. By default
inline parts with a filename are included, which covers common inline images.
Pass {:include-inline? false} to include only explicit attachments. -
read-email
Function v1.9.0(read-email source)(read-email ^Object source)(read-email source opts)(read-email ^Object source ^Map opts)Parses an RFC 5322 email message and extracts headers, body, and attachments.
show types
Returns {:headers headers :body {:text text-or-nil :html html-or-nil}
:attachments [attachment ...]}.
The body and attachments are extracted from the MIME entity tree produced by
read-mime-message. Non-multipart text/plain and text/html messages are handled
as body content. Attachment content is decoded according to
Content-Transfer-Encoding and represented as raw bytes in a Joker string.
opts are passed to joker.mime/read-entity and joker.mime/attachments and may
contain:
- include-inline? - false to exclude inline/file-name parts from attachments
- include-content?
- max-depth
- max-part-bytes -
read-message
Function v1.8.1(read-message source)(read-message ^Object source)Parses an RFC 5322 message from source and returns its headers and raw body.
show types
source must be a string or implement io.Reader, such as a string returned by
joker.pop3/retrieve. The result is a map of the form
{:headers {"Header-Name" ["value" ...]} :body "raw body"}.
Header names use Go net/mail's canonical form and header values remain
vectors so repeated headers are preserved. The complete message body is
buffered in memory. This function does not parse MIME parts or decode body
transfer encodings. Throws Error when source is invalid or the headers
cannot be parsed. -
read-mime-message
Function v1.9.0(read-mime-message source)(read-mime-message ^Object source)(read-mime-message source opts)(read-mime-message ^Object source ^Map opts)Parses an RFC 5322 email message and its MIME structure.
show types
source must be a string or implement io.Reader, such as a string returned by
joker.pop3/retrieve. The result is a joker.mime entity tree. Non-multipart
messages are returned as a single leaf entity, so joker.mime/body and
joker.mime/attachments work uniformly for both multipart and non-multipart
email.
opts are passed to joker.mime/read-entity and may contain:
- include-content?
- max-depth
- max-part-bytes