File: send_graph.py

package info (click to toggle)
graphite-web 1.1.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,592 kB
  • sloc: javascript: 86,823; python: 11,977; sh: 61; makefile: 50
file content (18 lines) | stat: -rw-r--r-- 699 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from django.core.mail import EmailMessage


def send_graph_email(subject, sender, recipients, attachments=None, body=None):
    """
    :param str sender: sender's email address
    :param list recipients: list of recipient emails
    :param list attachments: list of triples of the form:
        (filename, content, mimetype). See the django docs
        https://docs.djangoproject.com/en/1.3/topics/email/#django.core.mail.EmailMessage
    """
    attachments = attachments or []
    msg = EmailMessage(subject=subject,
                       from_email=sender,
                       to=recipients,
                       body=body,
                       attachments=attachments)
    msg.send()