# HG changeset patch # User Adrien Di Mascio # Date 1232013045 -3600 # Node ID cc9e8986d55e93b262f6e48397ece394e4a9a2f0 # Parent 5269bfc6813f31d6f6140b08cb3f093cef10bc03 sort email addresses and remove doubled ones before sending the email diff -r 5269bfc6813f -r cc9e8986d55e common/mail.py --- a/common/mail.py Thu Jan 15 08:47:18 2009 +0100 +++ b/common/mail.py Thu Jan 15 10:50:45 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: