Mercurial > kallithea
diff rhodecode/lib/celerylib/tasks.py @ 689:ecc566f8b69f beta
fixes #59, notifications for user registrations + some changes to mailer
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 14 Nov 2010 19:57:14 +0100 |
parents | 87943675813a |
children | 7486da5f0628 |
line wrap: on
line diff
--- a/rhodecode/lib/celerylib/tasks.py Sun Nov 14 17:24:32 2010 +0100 +++ b/rhodecode/lib/celerylib/tasks.py Sun Nov 14 19:57:14 2010 +0100 @@ -230,15 +230,31 @@ @task def send_email(recipients, subject, body): + """ + Sends an email with defined parameters from the .ini files. + + + :param recipients: list of recipients, it this is empty the defined email + address from field 'email_to' is used instead + :param subject: subject of the mail + :param body: body of the mail + """ log = send_email.get_logger() email_config = dict(config.items('DEFAULT')) + + if not recipients: + recipients = [email_config.get('email_to')] + + def str2bool(v): + return v.lower() in ["yes", "true", "t", "1"] + mail_from = email_config.get('app_email_from') user = email_config.get('smtp_username') passwd = email_config.get('smtp_password') mail_server = email_config.get('smtp_server') mail_port = email_config.get('smtp_port') - tls = email_config.get('smtp_use_tls') - ssl = False + tls = str2bool(email_config.get('smtp_use_tls')) + ssl = str2bool(email_config.get('smtp_use_ssl')) try: m = SmtpMailer(mail_from, user, passwd, mail_server,