web/lib/django/core/mail/backends/base.py
changeset 29 cc9b7e14412b
equal deleted inserted replaced
28:b758351d191f 29:cc9b7e14412b
       
     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