简体   繁体   English

Heroku Mandrill部署设置

[英]Heroku Mandrill Deployment Setup

Working on a Python/Django app, deploying with Heroku and sending emails with Mandrill. 使用Python / Django应用程序,使用Heroku部署并使用Mandrill发送电子邮件。 I've been able to send emails using my local configuration, but when I deploy to Heroku, the mail doesn't send but Heroku doesn't throw an error. 我已经能够使用我的本地配置发送电子邮件,但是当我部署到Heroku时,邮件不会发送,但Heroku不会抛出错误。 When I check heroku config my Mandrill api key and username are both there. 当我检查heroku config我的Mandrill api密钥和用户名都在那里。

Here are my email settings from settings.py: 以下是来自settings.py的电子邮件设置:

import os
EMAIL_HOST = 'smtp.mandrillapp.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = os.environ.get('MANDRILL_USERNAME')
EMAIL_HOST_PASSWORD = os.environ.get('MANDRILL_APIKEY')
EMAIL_USE_TLS = True

Any idea what might be the problem? 知道可能是什么问题吗?

Turns out I needed to add DEFAULT_FROM_EMAIL to my settings.py file. 结果我需要将DEFAULT_FROM_EMAIL添加到我的settings.py文件中。 It was working locally because the DEFAULT_FROM_EMAIL was set in global_settings.py, which isn't pushed to Heroku. 它在本地工作,因为DEFAULT_FROM_EMAIL是在global_settings.py中设置的,而不是推送到Heroku。

Make sure to have a look at your Mandrill API Logs if your messages aren't sending. 如果您的邮件没有发送,请务必查看您的Mandrill API日志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM