core (tools/email): an unicode "to" email (instead of a list) can now be used

This commit is contained in:
Goffi 2017-07-05 15:02:52 +02:00
commit 359b3a1b43

View file

@ -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: