示例#1
0
 def __init__(self, fail_silently=False, **kwargs):
     super().__init__(host=get_site_setting("smtp_host"),
                      port=get_site_setting("smtp_port"),
                      username=get_site_setting("smtp_user"),
                      password=get_site_setting("smtp_password"),
                      use_tls=get_site_setting("use_tls"),
                      fail_silently=fail_silently,
                      **kwargs)
示例#2
0
 def __init__(self, fail_silently=False, **kwargs):
     super(EmailBackend,
           self).__init__(host=get_site_setting('smtp_host'),
                          port=get_site_setting('smtp_port'),
                          username=get_site_setting('smtp_user'),
                          password=get_site_setting('smtp_password'),
                          use_tls=get_site_setting('use_tls'),
                          fail_silently=fail_silently,
                          **kwargs)
示例#3
0
 def send_messages(self, email_messages):
     """
     Override the from_email property all email messages.
     """
     if not email_messages:
         return
     with self._lock:
         for message in email_messages:
             message.from_email = get_site_setting('smtp_from_address')
     try:
         super(EmailBackend, self).send_messages(email_messages)
     except (SMTPResponseException, socket_error) as e:
         # TODO: Determine how to handle failures gracefully.
         raise e
示例#4
0
 def process_request(self, request):
     tzname = get_site_setting('i18n_timezone')
     if tzname:
         timezone.activate(pytz.timezone(tzname))
     else:
         timezone.deactivate()