source: asadb/util/emails.py

space-accessstablestage
Last change on this file was 6dfcd66, checked in by MIT Association of Student Activities <asa@…>, 14 years ago

Use Django default email sender config

Baking in our own default is vaguely silly. See also
https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-DEFAULT_FROM_EMAIL

  • Property mode set to 100644
File size: 517 bytes
Line 
1from django.core.mail import EmailMessage
2from django.template import Context, Template
3from django.template.loader import get_template
4
5def email_from_template(tmpl, context,
6        subject, to=[], cc=[], from_email=None, ):
7    tmpl_obj = get_template(tmpl)
8    ctx = Context(context)
9    body = tmpl_obj.render(ctx)
10    email = EmailMessage(
11        subject=subject,
12        body=body,
13        from_email=from_email,
14        to=to,
15        cc=cc,
16        bcc=['asa-db-outgoing@mit.edu', ],
17    )
18    return email
Note: See TracBrowser for help on using the repository browser.