gpt4 book ai didi

python - Send_mail 未发送邮件至 gmail id。 [ Django ]

转载 作者:太空宇宙 更新时间:2023-11-03 17:29:05 25 4
gpt4 key购买 nike

设置.py

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

DEFAULT_FROM_EMAIL = 'xxxxx@gmail.com'
SERVER_EMAIL = 'xxxxx@gmail.com'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'papercrib09@gmail.com'
EMAIL_HOST_PASSWORD = 'XXXXX'

View .py

print "before sending the mail"
send_mail(email_subject, email_body, 'xxx@gmail.com',
[yyy@gmail.com], fail_silently=False)
print "after sending the mail"

执行后我可以看到邮件从xxx@gmail.com发送到yyy@gmail.com

发送邮件之前:

MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Subject: Account confirmation
From: xxx@gmail.com
To: yyy@gmail.com
Date: Sat, 22 Aug 2015 18:22:13 -0000
Message-ID: <20150822182213.5748.80357@SymMacToolkit-CPWKWBL7DTY3>

Hey user, thanks for signing up. To activate your account, click this link within 48 hours http://127.0.0.1:8000/accounts/confirm/1900aac9e91300ef2b35fdcc8cdc16305b2e0c18

发送邮件后:

什么都没有。

最佳答案

您已在设置文件中添加了 followring 中间件

'django.core.mail.backends.console.EmailBackend'

这不会向 Gmail 客户端发送电子邮件。电子邮件正文将打印在运行应用程序的应用程序控制台上。尝试删除此行

关于python - Send_mail 未发送邮件至 gmail id。 [ Django ],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32159536/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com