Next: , Up: Contacts   [Contents]


4.1 Contact procedures and objects

Message objects (see Messages) have a method mu:contacts:

(mu:contacts <message-object> [<contact-type>])

The <contact-type> is a symbol, one of mu:to, mu:from, mu:cc or mu:bcc. This will then get the contact objects for the contacts of the corresponding type. If you leave out the contact-type (or specify #t for it, you will get a list of all contact objects for the message.

A contact object (<mu:contact>) has two methods:

Let’s get a list of all names and e-mail addresses in the ’To:’ field, of messages matching ’book’:

(use-modules (mu))
(mu:initialize)
(mu:for-each-message
   (lambda (msg)
      (for-each
        (lambda (contact)
           (format #t "~a => ~a\n"
             (or (mu:email contact) "") (or (mu:name contact) "no-name")))
        (mu:contacts msg mu:field:to)))
    "book")

This shows what the methods do, but for many uses, it would be more useful to have each of the contacts only show up once - for that, please refer to See All contacts.