# HG changeset patch # User Adrien Di Mascio # Date 1232010805 -3600 # Node ID a81d3babb5825e9ddd96f326ceadc9f65adb5485 # Parent 5269bfc6813f31d6f6140b08cb3f093cef10bc03 sort email addresses and remove doubled ones before sending the email diff -r 5269bfc6813f -r a81d3babb582 common/mail.py --- a/common/mail.py Thu Jan 15 08:47:18 2009 +0100 +++ b/common/mail.py Thu Jan 15 10:13:25 2009 +0100 @@ -56,9 +56,10 @@ msg['Reply-to'] = msg['From'] if config is not None: msg['X-CW'] = config.appid - msg['To'] = ', '.join(addrheader(addr) for addr in to_addrs if addr is not None) + unique_addrs = lambda addrs: sorted(set(addr for addr in addrs if addr is not None)) + msg['To'] = ', '.join(addrheader(addr) for addr in unique_addrs(to_addrs)) if cc_addrs: - msg['Cc'] = ', '.join(addrheader(addr) for addr in cc_addrs if addr is not None) + msg['Cc'] = ', '.join(addrheader(addr) for addr in unique_addrs(cc_addrs)) if msgid: msg['Message-id'] = msgid if references: