我们从Python开源项目中,提取了以下32个代码示例,用于说明如何使用django.conf.settings.EMAIL_HOST_PASSWORD。
def __init__(self, host=None, port=None, username=None, password=None, use_tls=None, fail_silently=False, use_ssl=None, timeout=None, ssl_keyfile=None, ssl_certfile=None, **kwargs): super(EmailBackend, self).__init__(fail_silently=fail_silently) self.host = host or settings.EMAIL_HOST self.port = port or settings.EMAIL_PORT self.username = settings.EMAIL_HOST_USER if username is None else username self.password = settings.EMAIL_HOST_PASSWORD if password is None else password self.use_tls = settings.EMAIL_USE_TLS if use_tls is None else use_tls self.use_ssl = settings.EMAIL_USE_SSL if use_ssl is None else use_ssl self.timeout = settings.EMAIL_TIMEOUT if timeout is None else timeout self.ssl_keyfile = settings.EMAIL_SSL_KEYFILE if ssl_keyfile is None else ssl_keyfile self.ssl_certfile = settings.EMAIL_SSL_CERTFILE if ssl_certfile is None else ssl_certfile if self.use_ssl and self.use_tls: raise ValueError( "EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive, so only set " "one of those settings to True.") self.connection = None self._lock = threading.RLock()
def __init__(self, host=None, port=None, username=None, password=None, use_tls=None, fail_silently=False, **kwargs): super(EmailBackend, self).__init__(fail_silently=fail_silently) self.host = host or settings.EMAIL_HOST self.port = port or settings.EMAIL_PORT if username is None: self.username = settings.EMAIL_HOST_USER else: self.username = username if password is None: self.password = settings.EMAIL_HOST_PASSWORD else: self.password = password if use_tls is None: self.use_tls = settings.EMAIL_USE_TLS else: self.use_tls = use_tls self.smtp = (self.host, self.port, self.username, self.password, self.use_tls) self._lock = threading.RLock()
def check_production_settings(app_configs, **kwargs): issues = [] if settings.DEBUG: return issues if not settings.EMAIL_HOST_PASSWORD or 'TODO' in settings.EMAIL_HOST_PASSWORD: issues.append( Warning( "EMAIL_HOST_PASSWORD setting is not set to proper value", id='tg_utils.W001', ) ) if 'TODO' in settings.SITE_URL: issues.append( Warning( "SITE_URL setting is not set to proper value", id='tg_utils.W002', ) ) return issues
def __init__(self, host=None, port=None, username=None, password=None, use_tls=None, fail_silently=False, **kwargs): super(EmailBackend, self).__init__(fail_silently=fail_silently) self.host = host or settings.EMAIL_HOST self.port = port or settings.EMAIL_PORT if username is None: self.username = settings.EMAIL_HOST_USER else: self.username = username if password is None: self.password = settings.EMAIL_HOST_PASSWORD else: self.password = password if use_tls is None: self.use_tls = settings.EMAIL_USE_TLS else: self.use_tls = use_tls self.connection = None self._lock = threading.RLock()
def status_mail(request): form = TestEmailForm(request.POST or None) if form.is_valid(): body = """This email was sent as a request to test the Sentry outbound email configuration.""" try: send_mail( '%s Test Email' % (settings.EMAIL_SUBJECT_PREFIX,), body, settings.SERVER_EMAIL, [request.user.email], fail_silently=False ) except Exception as e: form.errors['__all__'] = [six.text_type(e)] return render_to_response('sentry/admin/status/mail.html', { 'form': form, 'EMAIL_HOST': settings.EMAIL_HOST, 'EMAIL_HOST_PASSWORD': bool(settings.EMAIL_HOST_PASSWORD), 'EMAIL_HOST_USER': settings.EMAIL_HOST_USER, 'EMAIL_PORT': settings.EMAIL_PORT, 'EMAIL_USE_TLS': settings.EMAIL_USE_TLS, 'SERVER_EMAIL': settings.SERVER_EMAIL, }, request)
def send_mail(email, subject, template_html, template_txt, context, **kwargs): """ ????????? email ????????????. ?????????: email - ????? ??????????? ????? subject - ????????? ?????? template_html - ???? ?? ??????? ? html ????????? template_txt - ???? ?? ?????????? ??????? context - ??????? ? ???????, ? ???????? ????? ??????????? ??????? """ email_html = render_to_string(template_html, context) email_text = render_to_string(template_txt, context) django_send_mail( auth_user=settings.EMAIL_HOST_USER, auth_password=settings.EMAIL_HOST_PASSWORD, from_email=settings.DEFAULT_FROM_EMAIL, subject=subject, recipient_list=[email], fail_silently=kwargs.pop('fail_silently', True), html_message=email_html, message=email_text, **kwargs )