core (tools/email): an unicode "to" email (instead of a list) can now be used
This commit is contained in:
parent
5ef5fc36f1
commit
359b3a1b43
1 changed files with 4 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue