diff options
Diffstat (limited to 'Mailman/pythonlib/rfc822.py')
| -rw-r--r-- | Mailman/pythonlib/rfc822.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Mailman/pythonlib/rfc822.py b/Mailman/pythonlib/rfc822.py index d8de862cf..7ce3ff254 100644 --- a/Mailman/pythonlib/rfc822.py +++ b/Mailman/pythonlib/rfc822.py @@ -310,6 +310,22 @@ class Message: a = AddrlistClass(data) return a.getaddrlist() + def getallrecipients(self): + """Returns a list of the all the recipient addresses. + + This list is of 2-tuple elements as returned by getaddr(), but is a + collation of all the To: and Cc: headers found in the message. + """ + rawrecips = [] + for h in (self.getallmatchingheaders('to') + + self.getallmatchingheaders('cc')): + i = string.find(h, ':') + if i > 0: + rawrecips.append(string.strip(h[i+1:])) + alladdrs = string.join(rawrecips, ', ') + a = AddressList(alladdrs) + return a.addresslist + def getdate(self, name): """Retrieve a date field from a header. |
