Ruby on rails rails 2.3.4中的SMTP设置

Ruby on rails rails 2.3.4中的SMTP设置,ruby-on-rails,smtp,mailer,Ruby On Rails,Smtp,Mailer,我已从rails 3.0迁移到rails 2.3.4。因此,目前有一位新手正在使用此版本。我想为我的rails 2.3.4应用程序设置SMTP设置,但找不到要创建或使用的文件,就像在rails 3.0中一样。Mailchimp已被用作发送批量邮件的第三方电子邮件提供商。通常在rails 2中,您将这些设置放入config/environments/*.rb。因为您的开发设置将不同于生产等 比如: config.action_mailer.smtp_settings = { :addr

我已从rails 3.0迁移到rails 2.3.4。因此,目前有一位新手正在使用此版本。我想为我的rails 2.3.4应用程序设置SMTP设置,但找不到要创建或使用的文件,就像在rails 3.0中一样。Mailchimp已被用作发送批量邮件的第三方电子邮件提供商。

通常在rails 2中,您将这些设置放入config/environments/*.rb。因为您的开发设置将不同于生产等

比如:

  config.action_mailer.smtp_settings = {
    :address => "localhost",
    :port => 2525
  }

在config/environments/development.rb的configure块中,通常在Rails 2中,您将这些设置放在config/environments/*.rb中。因为您的开发设置将不同于生产等

比如:

  config.action_mailer.smtp_settings = {
    :address => "localhost",
    :port => 2525
  }

在config/environments/development.rb的configure块中,为dev环境配置:config/environments/development.rb

下面是一个通过Google帐户发送邮件的典型配置

config.action_mailer.perform_deliveries = false # Set it to true to send the email in dev mode
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { :host => "localhost:3000" }


ActionMailer::Base.smtp_settings = {
                    :address        => "smtp.gmail.com",
                    :port           => 587,
                    :authentication => :plain,
                    :user_name      => "user@gmail.com",
                    :password       => "password"
}

dev环境的配置:Config/environments/development.rb

下面是一个通过Google帐户发送邮件的典型配置

config.action_mailer.perform_deliveries = false # Set it to true to send the email in dev mode
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { :host => "localhost:3000" }


ActionMailer::Base.smtp_settings = {
                    :address        => "smtp.gmail.com",
                    :port           => 587,
                    :authentication => :plain,
                    :user_name      => "user@gmail.com",
                    :password       => "password"
}