Rails 2.3.4 中的 SMTP 设置

发布于 2024-11-17 05:14:28 字数 140 浏览 0 评论 0原文

我已经从rails 3.0迁移到rails 2.3.4。所以目前这个版本是新手。我想为我的rails 2.3.4应用程序设置SMTP设置,但无法找到要创建或使用的文件,就像在rails 3.0中一样。 Mailchimp 已被用作第三方电子邮件提供商来发送批量消息。

I have moved from rails 3.0 to rails 2.3.4.So a newbie currently for this version.I want to set the SMTP settings for my rails 2.3.4 application but unable to find which file to create or use like as in rails 3.0.Mailchimp has been used as a 3rd party email provider to send bulk messages.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暖阳 2024-11-24 05:14:28

开发环境配置: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      => "[email protected]",
                    :password       => "password"
}

Config for dev environment: config/environments/development.rb

Here is a typical configuration that sends mail via Google Account.

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      => "[email protected]",
                    :password       => "password"
}
幻想少年梦 2024-11-24 05:14:28

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

所以类似:

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

在 config/environments/development.rb 的配置块中

Usually in Rails 2 you put those settings in config/environments/*.rb. Because your development settings will be different from production, etc etc.

So something like:

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

in the configure block in config/environments/development.rb

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文