开发者

Rails 3 Action Mailer Gmail

开发者 https://www.devze.com 2023-04-06 22:00 出处:网络
I am trying to understand how to properly configure Action Mailer for Rails 3 to work with Gmail. Read the article by Ryan Bates and also read the edge Rails page article. Ryan\'s article said to put

I am trying to understand how to properly configure Action Mailer for Rails 3 to work with Gmail. Read the article by Ryan Bates and also read the edge Rails page article. Ryan's article said to put the config details in /config/initializers/setup_mail.rb initializer file

ActionMailer::Base.smtp_settings = {  
  :address              => "smtp.gmail.com",  
  开发者_如何学运维:port                 => 587,  
  :domain               => "asciicasts.com",  
  :user_name            => "asciicasts",  
  :password             => "secret",  
  :authentication       => "plain",  
  :enable_starttls_auto => true  
} 

But the edge Rails article said put it in the config/environments/$RAILS_ENV.rb, anyone know which is the preferred way of doing it?


Put it wherever it makes sense for your particular project. If you need different settings for different environments then do that, otherwise you can put it into an initializer.

0

精彩评论

暂无评论...
验证码 换一张
取 消