【发布时间】:2013-11-21 15:33:46
【问题描述】:
我已经在 heroku 上部署了我的第一个应用程序。 在开发环境中设计工作正常。
#/config/initializers/devise.rb
#on my local machine
config.mailer_sender = ENV["GMAIL_USERNAME"]
其中 GMAIL_USERNAME 是我的个人电子邮件地址。
在生产中(在 heroku 上)我想使用 sendGrid。 如何使用“用于生产”的设计 mailer_sender 更改当前的设计 mailer_sender? 简单地说:
config.mailer_sender = info@example.com
如果我使用第二种解决方案,我如何从开发环境发送邮件
我只是有点困惑。
解决方案:
#/config/application.yml
#this file is generated by figaro gem and edited by me.
GMAIL_USERNAME: "xxx@gmail.com"
GMAIL_PASSWORD: "xx"
HOST: "localhost:3000"
SECRET_TOKEN: "dasdasd"
#reconfigure/reset the ENV variables in production environment
production:
GMAIL_USERNAME: no-reply@example.com
GMAIL_PASSWORD: #leave blanck to reset it
HOST: my-app.heroku.com
【问题讨论】:
标签: ruby-on-rails heroku devise sendgrid