我正在尝试在我的Rails应用上设置电子邮件联系表单,但我无法弄清楚如何在config / production中设置以读取我的密码,而不包括我的帐户。
这是一个heroku配置:
Jillians-MacBook-Pro-2:noises3 Jillian$ heroku config
=== noises Config Vars
DATABASE_URL: xxxdatabaseurlxxx
LANG: en_US.UTF-8
RACK_ENV: production
RAILS_ENV: production
RAILS_SERVE_STATIC_FILES: enabled
S3_BUCKET: muzack
SECRET_KEY_BASE: xxxsecretxxx
gmail_password: xxxmy_passwordxxx
gmail_username: xxxmy_emailxxx
我的smtp设置,在config / production.rb中:
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
user_name: ENV['gmail_username'],
password: ENV['gmail_password'],
authentication: :plain
}
在config / initializers / smtp_settings.rb中:
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "jho3292@gmail.com",
:password => WHAT DO I DO HERE???
:authentication => :plain,
:enable_starttls_auto => true
}
有谁知道如何正确地做到这一点?