当前位置: 首页>>代码示例>>Python>>正文


Python base.BaseEmailBackend方法代码示例

本文整理汇总了Python中django.core.mail.backends.base.BaseEmailBackend方法的典型用法代码示例。如果您正苦于以下问题:Python base.BaseEmailBackend方法的具体用法?Python base.BaseEmailBackend怎么用?Python base.BaseEmailBackend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.core.mail.backends.base的用法示例。


在下文中一共展示了base.BaseEmailBackend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_connection_config

# 需要导入模块: from django.core.mail.backends import base [as 别名]
# 或者: from django.core.mail.backends.base import BaseEmailBackend [as 别名]
def make_connection_config() -> BaseEmailBackend:
        from apps.notifications.app_vars import APP_VAR_EMAIL_HOST, APP_VAR_EMAIL_USE_TLS, \
            APP_VAR_EMAIL_PORT, APP_VAR_EMAIL_HOST_USER, APP_VAR_EMAIL_HOST_PASSWORD
        from apps.common.models import AppVar

        cache_vars = AppVar.get_values_by_category(AppVar.MAIL_CATEGORY)
        from apps.notifications.app_vars import APP_VAR_EMAIL_BACKEND
        backend_class = APP_VAR_EMAIL_BACKEND.get_cached_value(cache_vars)
        ctor = MailServerConfig.import_class(backend_class)

        return ctor(host=APP_VAR_EMAIL_HOST.get_cached_value(cache_vars),
                    port=APP_VAR_EMAIL_PORT.get_cached_value(cache_vars),
                    username=APP_VAR_EMAIL_HOST_USER.get_cached_value(cache_vars),
                    password=APP_VAR_EMAIL_HOST_PASSWORD.get_cached_value(cache_vars),
                    use_tls=APP_VAR_EMAIL_USE_TLS.get_cached_value(cache_vars),
                    fail_silently=False) 
开发者ID:LexPredict,项目名称:lexpredict-contraxsuite,代码行数:18,代码来源:mail_server_config.py

示例2: get_context_data

# 需要导入模块: from django.core.mail.backends import base [as 别名]
# 或者: from django.core.mail.backends.base import BaseEmailBackend [as 别名]
def get_context_data(self, **kwargs):
        """
        Use this view's BaseEmailBackend implementation to do a dry-run of
        sending the generated messages, and return a preview of the messages
        that would be sent.
        """
        self.messages = []
        self.generate_messages(current_round=self.get_round(), connection=self)

        # Find all URLs in all messages by asking Django's urlize function to
        # mark up URL-like text as HTML and then looking for the HTML that
        # urlize generated.
        urlize_re = re.compile(r'<a href="(.*?)"')
        urls = set()
        for message in self.messages:
            for url in urlize_re.finditer(urlize(message.body)):
                urls.add(url.group(1))

        context = super(SendEmailView, self).get_context_data(**kwargs)
        context['messages'] = self.messages
        context['urls'] = sorted(urls)
        return context 
开发者ID:outreachy,项目名称:website,代码行数:24,代码来源:dashboard.py

示例3: send_messages

# 需要导入模块: from django.core.mail.backends import base [as 别名]
# 或者: from django.core.mail.backends.base import BaseEmailBackend [as 别名]
def send_messages(self, messages):
        """
        Implementation of BaseEmailBackend that just saves the generated
        messages on self, so get_context_data can dig them back out again.
        """
        self.messages.extend(messages)
        return len(messages) 
开发者ID:outreachy,项目名称:website,代码行数:9,代码来源:dashboard.py


注:本文中的django.core.mail.backends.base.BaseEmailBackend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。