Mail utilities¶
-
render_to_email(email, template[, data][, request][, from_email][, attachment])¶ Renders
templatewith context constructed with help ofrequestand filled withdata, then sends it toemail. An email template could contain email headers:from handy.mail import render_to_email def approve(...): article = ... render_to_email(article.author.email, 'approved.html', {'article': article})
in approved.html:
Content-Type: text/html Subject: Your article «{{ article.title }}» approved Hello, {{ article.author.username }}!<br><br> ....
-
mail_admins(subject, message='', trace=True)¶ Send an email to admins, optionally appends stack trace to message. Handy when you want get an exception email but still serve user request.