Django发送gmail失败

问题描述

我在设置文件中配置了 gmail,如下所示:

#gmail_send/settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'yoorusername@gmail.com'
EMAIL_HOST_PASSWORD = 'key' #past the key or password app here
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'default from email'

我已经从谷歌开启了安全性较低的应用访问,但它仍然无法正常工作

这里是错误

SMTPSenderRefused at /register
(530,b'5.7.0 Authentication required. Learn more at\n5.7.0  https://support.google.com/mail/?p=WantAuthError n6sm1130142pgm.79 - gsmtp','"default from email"')
Request Method: POST
Request URL:    http://127.0.0.1:8000/register
Django Version: 3.2.3
Exception Type: SMTPSenderRefused
Exception Value:    
(530,'"default from email"')

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)