From 359b3a1b43dc34ab7b50beabda3e37a05bf2e111 Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 5 Jul 2017 15:02:52 +0200 Subject: [PATCH] core (tools/email): an unicode "to" email (instead of a list) can now be used --- src/tools/email.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/email.py b/src/tools/email.py index 34ecc499..6c90771a 100644 --- a/src/tools/email.py +++ b/src/tools/email.py @@ -31,12 +31,15 @@ from email.mime.text import MIMEText 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: