Next: Example - the longest subject, Previous: Finding messages, Up: Messages [Contents]
Now that we’ve seen how to retrieve lists of message objects
(<mu:message>
), let’s see what we can do with such an object.
<mu:message>
defines the following methods that all take a single
<mu:message>
object as a parameter. We won’t go into the exact meanings
for all of these procedures here - for the details about various flags /
properties, please refer to the mu-find man-page.
(mu:bcc msg)
: the Bcc field of the message, or #f if there is none
(mu:body-html msg)
: : the html body of the message, or #f if there is none
(mu:body-txt msg)
: the plain-text body of the message, or #f if there is none
(mu:cc msg)
: the Bcc field of the message, or #f if there is none
(mu:date msg)
: the Date field of the message, or 0 if there is none
(mu:flags msg)
: list of message-flags for this message
(mu:from msg)
: the From field of the message, or #f if there is none
(mu:maildir msg)
: the maildir this message lives in, or #f if there is none
(mu:message-id msg)
: the Message-Id field of the message, or #f if there is none
(mu:path msg)
: the file system path for this message
(mu:priority msg)
: the priority of this message (either mu:prio:low, mu:prio:normal or mu:prio:high
(mu:references msg)
: the list of messages (message-ids) this message
refers to in(mu: the References: header
(mu:size msg)
: size of the message in bytes
(mu:subject msg)
: the Subject field of the message, or #f if there is none.
(mu:tags msg)
: list of tags for this message
(mu:timestamp msg)
: the timestamp (mtime) of the message file, or
#f if there is none.
message file
(mu:to msg)
: the sender of the message, or #f if there is none
With these methods, we can query messages for their properties; for example:
scheme@(guile-user)> (define msg (car (mu:message-list "snow"))) scheme@(guile-user)> (mu:subject msg) $1 = "Re: Running in the snow is beautiful" scheme@(guile-user)> (mu:flags msg) $2 = (mu:flag:replied mu:flag:seen) scheme@(guile-user)> (strftime "%F" (localtime (mu:date msg))) $3 = "2011-01-15"
There are a couple more methods:
(mu:header msg "<header-name>")
returns an arbitrary message
header (or #f if not found) – e.g. (header msg "User-Agent")
(mu:contacts
msg [contact-type])
method (to get a list of contacts) is
added. See Contacts.
((mu:parts msg)
and
(mu:attachments msg)
methods are added. See Attachments and other parts.
Next: Example - the longest subject, Previous: Finding messages, Up: Messages [Contents]