~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to django/core/mail/backends/base.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2010-05-21 07:52:55 UTC
  • mfrom: (1.3.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20100521075255-ii78v1dyfmyu3uzx
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""Base email backend class."""
 
2
 
 
3
class BaseEmailBackend(object):
 
4
    """
 
5
    Base class for email backend implementations.
 
6
 
 
7
    Subclasses must at least overwrite send_messages().
 
8
    """
 
9
    def __init__(self, fail_silently=False, **kwargs):
 
10
        self.fail_silently = fail_silently
 
11
 
 
12
    def open(self):
 
13
        """Open a network connection.
 
14
 
 
15
        This method can be overwritten by backend implementations to
 
16
        open a network connection.
 
17
 
 
18
        It's up to the backend implementation to track the status of
 
19
        a network connection if it's needed by the backend.
 
20
 
 
21
        This method can be called by applications to force a single
 
22
        network connection to be used when sending mails. See the
 
23
        send_messages() method of the SMTP backend for a reference
 
24
        implementation.
 
25
 
 
26
        The default implementation does nothing.
 
27
        """
 
28
        pass
 
29
 
 
30
    def close(self):
 
31
        """Close a network connection."""
 
32
        pass
 
33
 
 
34
    def send_messages(self, email_messages):
 
35
        """
 
36
        Sends one or more EmailMessage objects and returns the number of email
 
37
        messages sent.
 
38
        """
 
39
        raise NotImplementedError