django - 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, 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"')
解决方案
推荐阅读
- google-app-engine - Ingress with subdomains
- java - MultivariateOptimizer is abstract; cannot be instantiated error when trying to optimize a function in Java
- reactjs - Redux Form 提交空搜索值查询时出错
- javascript - ReactJS - 如何在 API 中获取值以显示文本?
- unity3d - UNITY 访问非静态成员“Outline.OutlineMode”需要对象引用
- angular - Ngfor 从一个数组中获取名称,其中 id = 来自另一个数组的 id 并添加一个逗号直到最后一个元素
- apache-spark - 加入两个产生空数据的 RDD
- kubernetes - minikube 仪表板在 macOS 上返回 503 错误
- python - 阅读 HTTP 标头 Python
- google-cloud-platform - 将公共 IP 分配给 GCP 上的嵌套虚拟机,而不使用代理或端口转发