You are a coding machine.

> On Mar 20, 2015, at 2:13 PM, humbed...@apache.org wrote:
> 
> +def email(rcpt, subject, message):
> +    sender = config.get("email", "sender")
> +    signature = config.get("email", "signature")
> +    receivers = [rcpt]
> +    msg = """From: %s
> +To: %s
> +Subject: %s
> +
> +%s
> +
> +With regards,
> +%s
> +--
> +Powered by Apache STeVe - https://steve.apache.org 
> <https://steve.apache.org/>
> +""" % (sender, rcpt, subject, message, signature)
> +    
> +    try:
> +       smtpObj = smtplib.SMTP(config.get("email", "mta"))
> +       smtpObj.sendmail(sender, receivers, msg)         
> +    except SMTPException:
> +       raise Exception("Could not send email - SMTP server down?")
> +       
> \ No newline at end of file

Consider using jinja2 templates.


Regards,
Alan

Reply via email to