我正在尝试从 Ubuntu 上 docker 中的 django 应用程序发送电子邮件,并且收到以下消息:
Request Method: GET
Request URL: https://localhost:8001/accounts/mail/
Django Version: 2.2.5
Exception Type: SMTPAuthenticationError
Exception Value:
(535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials x76sm1225174ljb.81 - gsmtp')
Exception Location: /usr/local/lib/python3.7/smtplib.py in auth, line 642
Python Executable: /usr/local/bin/python
Python Version: 3.7.4
Run Code Online (Sandbox Code Playgroud)
在docker外发送邮件是没有问题的。
我尝试了Google 故障排除步骤中的每一步。目前我有两步验证,适用于本地应用程序,但仍然不适用于 docker one。
我不一定需要 Google SMTP(我在那里有一个帐户),但我要实现的是在注册 django 应用程序后向用户发送带有激活链接的电子邮件。
我在没有双因素身份验证的情况下尝试过 - 结果相同。我在 Web 服务中的 docker-compose 设置:
services:
web:
build: ./app
command: python manage.py runsslserver 0.0.0.0:8001
stdin_open: true
tty: true …Run Code Online (Sandbox Code Playgroud)