本文介绍了服务器不支持STARTTLS扩展-尝试通过Django和私人电子邮件地址发送电子邮件时出现此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用namecheap.com注册了域和私人电子邮件.我正在尝试从此私人电子邮件中发送电子邮件.但是,标题出现错误.

I registered a domain and a private email using namecheap.com. I am trying to send an email from this private email. However, I get the error in the title.

在我的settings.py中,我具有以下设置:

In my settings.py, I have these settings:

EMAIL_HOST = 'mail.privateemail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'my password'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER

我正在尝试通过视图发送电子邮件:

And I am trying to send the email through a view:

send_mail(
    'Subject here',
    'Here is the message.',
    '[email protected]',
    ['[email protected]'],
    fail_silently=False,
)

但是,出现此错误:

SMTPException at /
STARTTLS extension not supported by server.

知道为什么吗?感谢您的帮助.

Any idea why? Any help is appreciated.

编辑

将EMAIL_USE_TLS更改为False,并同时将其删除以分别检查两者之后,我现在得到此错误:

After changing the EMAIL_USE_TLS to False, and also removing it to check both separately, I get this error now:

SMTP AUTH extension not supported by server.

知道为什么吗?谢谢!

推荐答案

您的服务器mail.privateemail.com不知道什么是STARTTLS SMTP Commnad

your server mail.privateemail.com does not know what is STARTTLS SMTP Commnad is

这可能在两种情况下发生:

this may happen in two cases:

  1. 您的服务器(mail.privateemail.com)完全不支持安全通信,您需要使用普通的非加密通信.
  2. 您试图连接到已经使用SSL作为通信的端口,然后使用STARTTLS将连接升级为安全毫无意义.
  3. 您的服务器配置不正确,并且忽略了提交端口(587)上的STARTTLS.

判断您正在连接到端口587,该端口应该提供简单的通信-它是1或3.

Judging, that you are connecting to port 587 which should provide plain communication - it's either 1 or 3.

如果您希望它能正常工作,请删除EMAIL_USE_TLS = True或将其设置为False,否则-SMTP服务器配置应固定.

If you want this just work, remove EMAIL_USE_TLS = True or set it to False, otherwise - SMTP server configuration should be fixed.

这篇关于服务器不支持STARTTLS扩展-尝试通过Django和私人电子邮件地址发送电子邮件时出现此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 08:31