changeset 2304:666ad9de044c

core (tools/email): an unicode "to" email (instead of a list) can now be used
author Goffi <goffi@goffi.org>
date Wed, 05 Jul 2017 15:02:52 +0200
parents 37887b5acb25
children 972e33507609
files src/tools/email.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/tools/email.py	Wed Jul 05 14:50:45 2017 +0200
+++ b/src/tools/email.py	Wed Jul 05 15:02:52 2017 +0200
@@ -31,12 +31,15 @@
 def sendEmail(host, to_emails, subject=u'', body=u'', from_email=None):
     """send an email using SàT configuration
 
-    @param to_emails(list[unicode]): list of recipients
+    @param to_emails(list[unicode], unicode): list of recipients
+        if unicode, it will be split to get emails
     @param subject(unicode): subject of the message
     @param body(unicode): body of the message
     @param from_email(unicode): address of the sender
     @return (D): same as smtp.sendmail
     """
+    if isinstance(to_emails, basestring):
+        to_emails = to_emails.split()
     email_host = host.memory.getConfig(None, u'email_server') or u'localhost'
     email_from = host.memory.getConfig(None, u'email_from')
     if email_from is None: