【问题标题】:How to send mail (like noreply) with Django sendgrid如何使用 Django sendgrid 发送邮件(如 noreply)
【发布时间】:2022-07-23 05:09:34
【问题描述】:

我是新手!

我想创建一个发送邮件的 django 应用程序。它在本地主机上运行良好,但是当我部署它时,它停止工作,因为主机不支持 smtp。他建议使用 sendgrid,而我被困在这里......

enter image description here sorry i dont have permission to put pic only link 视图.py enter image description here 错误: enter image description here

【问题讨论】:

  • 请您在问题中提供您的代码而不是图片?

标签: python django sendgrid


【解决方案1】:

您在此处附加的图像中的错误消息显示 403 禁止,这意味着服务器理解请求但拒绝授权。在验证发送地址时,检查是否使用了来自电子邮件地址。阅读此链接中的文档https://docs.sendgrid.com/ui/sending-email/sender-verification

并检查您对 sendgrid 的所有设置是否正确。

SENDGRID_API_KEY = os.getenv('SENDGRID_API_KEY')

EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'apikey' # this is exactly the value 'apikey'
EMAIL_HOST_PASSWORD = SENDGRID_API_KEY
EMAIL_PORT = 587
EMAIL_USE_TLS = True

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-08
    • 2018-10-23
    • 1970-01-01
    相关资源
    最近更新 更多