代码之家  ›  专栏  ›  技术社区  ›  Henry Lynx

ZOHO smtp SMTPAuthenticationError位于/(535,“身份验证失败”)Django应用程序

  •  2
  • Henry Lynx  · 技术社区  · 7 年前

    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/

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

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

    我的设置。py是:

    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 = '*********'
    

    网上有很多关于这一点的帖子,但甚至没有一个答案。他们的支持已经到第三天了。。。

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

    SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)
    
    4 回复  |  直到 7 年前
        1
  •  14
  •   Henry Lynx    7 年前

    原来我是在zoho的欧洲主机下注册的,所以我将EMAIL_主机更改为“smtp.zoho.eu”

        2
  •  2
  •   Jose Cherian    7 年前

    这是我在“设置”中的唯一设置。py,这足以让它工作。

    #Email Settings
    EMAIL_USE_SSL = True
    EMAIL_HOST = 'smtp.zoho.com'
    EMAIL_PORT = 465
    EMAIL_HOST_USER = 'someone@example.com'
    EMAIL_HOST_PASSWORD = 'yourpassword'
    DEFAULT_FROM_EMAIL = 'someone@example.com'
    SERVER_EMAIL = 'someone@example.com'
    

    Django Docs .

    from django.core.mail import send_mail
    
    send_mail(
        'Subject here',
        'Here is the message.',
        'from@example.com',
        ['to@example.com'],
        fail_silently=False,
    )
    

    enter image description here

        3
  •  0
  •   Toshiuk Hirahata    5 年前

    我不得不在工作中添加ignoreTLS

    const transport = nodemailer.createTransport({
        host: "smtp.zoho.eu",
        port: 465,
        secure: true,
        auth: {
            user: config.ZOHO_USER,
            pass: config.ZOHO_PASS
        },
        ignoreTLS: true // <----
    });
    
        4
  •  0
  •   ntk4    4 年前

    看起来你已经解决了这个问题,但我遇到了同样的错误,并发现解决方案是我最近在帐户上启用了2FA,所以我必须添加一个特定于应用程序的密码。

    有关执行此操作的说明,请参阅 Zoho Mail docs