2
我想用我的django應用程序發送電子郵件。但設置Zoho帳戶並在settings.py中添加必要的行後,我仍然無法發送電子郵件,並且它一直給出SMTPAuthenticationError(535,b'Authentication Failed')。使用Django使用Zoho smtp進行身份驗證失敗
#settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.zoho.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'mypass'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
#views.py
html = render_to_string('email/code_email.html',{'code':code})
send_mail('Your Code',
'Hello',
'[email protected]',
['[email protected]'],
html_message=html
)
return render(request,'index.html')
嘿,你有沒有找到解決方案? –