【问题标题】:Email configuration in Redmine - undefined method `address='Redmine 中的电子邮件配置 - 未定义的方法 `address='
【发布时间】:2018-03-16 08:58:57
【问题描述】:

我不是 Ruby 和 Redmine 方面的专家,但我正在尝试在 redmine 中配置电子邮件通知。 Redmine 3.4 版 红宝石 2.3.3p222 Phusion 乘客 5.1.7

在 configuration.yml 我有

production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: "xxxx.pl"
port: 587
authentication: :plain
domain: 'redmine.xxx.pl'
user_name: '.....@redmine.xxx.pl'
password: '......'

但我收到此错误:

Error ID: 54731089
  Error details saved to: /tmp/passenger-error-WqNBmN.html
  Message from application: undefined method `address=' for ActionMailer::Base:Class (NoMethodError)

我稍微搜索了一下,发现我在 application.rb 文件中缺少方法。

所以在 Redmine config/application.rb 中我添加了类似的内容:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address:              "xxx.pl",
port:                 587,
user_name:            'powiadomienia@redmine.xxx.pl',
password:            '.....',
authentication:       :plain
}

但仍然有同样的错误。不幸的是,我在 Redmine 配置中找不到任何示例。

谁能帮帮我?

【问题讨论】:

  • 您不需要在application.rb 中添加您的邮件配置。 Redmine 的configuration.yml 就够了。属于您的错误消息的堆栈跟踪将有助于确定到底哪里出了问题。
  • 是的,但仍然有同样的错误。即使我使用默认的application.rb 并在configuration.yml 中配置电子邮件,仍然有同样的错误,redmine 无法启动。

标签: ruby-on-rails ruby email smtp redmine


【解决方案1】:

确保您的 configuration.yml 缩进正确(每级缩进使用 2 个空格):

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: 'example.org'
      port: 587

smtp 设置(地址、端口等)需要是 smtp_settings 哈希中的键。根据您得到的错误,我会说它们是与smtp_settings 处于同一级别的键,这是错误的。

【讨论】:

  • 该死的,我更新了,虽然那个空间很重要。谢谢jkraemer。这样就解决了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-01-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多