info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to parse "To" and "Cc" headers?


From: Teemu Likonen
Subject: Re: How to parse "To" and "Cc" headers?
Date: Sat, 31 Jan 2009 06:09:12 GMT
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

On 2009-01-30 09:27 (-0600), Ted Zlatanov wrote:

> I think you want mail-extract-address-components.  It returns a list of
> name-address pairs.  You know how to get the whole To: and Cc: lines, I
> assume.

Thanks! So to answer my original question, below is a code which returns
a list consisting strings of email addresses: ("person@somewhere"
"someoneelse@invalid" "user@isp.invalid"). The address list is
constructed from To and Cc fields.


(save-excursion
  (goto-char (point-min))
  (let (recipients
        (to-lst
         (mail-extract-address-components
          (or (cdr (assoc 'to (mail-header-extract-no-properties))) "")
          'all))
        (cc-lst
         (mail-extract-address-components
          (or (cdr (assoc 'cc (mail-header-extract-no-properties))) "")
          'all)))
    (dolist (item (append to-lst cc-lst) recipients)
      (add-to-list 'recipients
                   (nth 1 item)))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]