Commit cabb7eae authored by Aurel's avatar Aurel

make sure we do not send mail to the same email address multiple time

parent 94f2c311
...@@ -664,18 +664,18 @@ class EmailDocument(TextDocument): ...@@ -664,18 +664,18 @@ class EmailDocument(TextDocument):
additional_headers['In-Reply-To'] = destination_reference additional_headers['In-Reply-To'] = destination_reference
# To (multiple) # To (multiple)
to_url_list = [] to_url_list = set()
if to_url is None: if to_url is None:
for recipient in self.getDestinationValueList(): for recipient in self.getDestinationValueList():
email = recipient.getDefaultEmailText() email = recipient.getDefaultEmailText()
if email: if email:
to_url_list.append(formataddr((recipient.getTitle(), email))) to_url_list.add(formataddr((recipient.getTitle(), email)))
else: else:
raise ValueError, 'Recipient %s has no defined email' % recipient raise ValueError, 'Recipient %s has no defined email' % recipient
if not to_url_list: if not to_url_list:
to_url_list.append(self.getRecipient()) to_url_list.add(self.getRecipient())
elif type(to_url) in types.StringTypes: elif type(to_url) in types.StringTypes:
to_url_list.append(to_url) to_url_list.add(to_url)
# Attachments # Attachments
if attachment_list is None: if attachment_list is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment