ZOHO smtp SMTPAuthenticationError at /(535,'Authentication Failed')Django app [英] ZOHO smtp SMTPAuthenticationError at / (535, 'Authentication Failed') Django app

查看:193
本文介绍了ZOHO smtp SMTPAuthenticationError at /(535,'Authentication Failed')Django app的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用以下代码通过VPS上的外壳建立连接:

I am trying to establish a connection via shell on the VPS with this code:

import smtplib
from email.mime.text import MIMEText


sender = 'my zoho email'
recipient = 'my gmail account email'


msg = MIMEText("Message text")
msg['Subject'] = "Sent from python"
msg['From'] = sender
msg['To'] = recipient


server = smtplib.SMTP_SSL('smtp.zoho.com', 465)

# Perform operations via server
server.login('my zoho account email', '*********')

所有凭据均为正确,因为我已经成功登录到 https://www.zoho.eu/mail/

All the credentials are correct, since I am login in successfully to my account at https://www.zoho.eu/mail/

当我尝试登录时:

server.login('my zoho account email', '*********')

我收到SMTPAuthenticationError并且堆栈跟踪显示:

I get SMTPAuthenticationError and the stack trace shows:

 self.connection.login(force_str(self.username), force_str(self.password)) 
 ...
 raise SMTPAuthenticationError(code, resp)

我的settings.py是:

my settings.py is:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'     
EMAIL_USE_TSL = True
EMAIL_PORT = 465
EMAIL_HOST = 'smtp.zoho.com'
EMAIL_HOST_USER = '**********'
EMAIL_HOST_PASSWORD = '*********'

网络上有很多与此相关的话题,但是甚至没有人对此有答案。他们的支持到现在还没有结束……

There are numerous threads about this on the web but, not even one has an answer about it. Their support doesn't answer for third day now...

我正在使用NGINX,并且未为https://设置默认配置,但我的自定义配置为网站正在通过https://运行。

I am using NGINX and the default configuration is not set for https:// but my custom configuration is and the website is running over https://.

编辑:如果我尝试通过587连接端口,则使用:

If I try to connect over port 587 with:

server = smtplib.SMTP_SSL('smtp.zoho.com', 587)

我得到:

SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)


推荐答案

结果我是在zoho的欧洲主机下注册的,所以我通过将EMAIL_HOST更改为'smtp.zoho.eu'

Turns out I was registered under the European host of zoho so I fixed it by changing the EMAIL_HOST to 'smtp.zoho.eu'

这篇关于ZOHO smtp SMTPAuthenticationError at /(535,'Authentication Failed')Django app的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆