首页 > 解决方案 > 在 RoR 应用程序 configuration.yml 中使用 ActionMailer default_options "from"

问题描述

我正在使用 Ruby 2.4.5 在我的公司服务器上部署 Redmine 4.1.1(一个 RoR 应用程序),但我无法使用 SMTP 功能。

我必须使用选项中的 ActionMailer指示发件人电子邮件与用于身份验证的用户名不同。在我看来,我的 configuration.yml 文件中的“from”选项没有被使用,因为我收到了这个 550 错误:

550 5.7.1 Client does not have permissions to send as this sender

使用 Python smtplib 我已经能够发送电子邮件以验证凭据和配置是否正常工作,因此我可能在应用程序的配置中遗漏了一些东西。

下面是我的 configuration.yml 文件:

production:
  email_delivery:
    default_options:
      from: 'email@company.com'   
  delivery_method: :smtp
    smtp_settings:
      address: ''
      enable_starttls_auto: true
      port: 1
      authentication: :login
      user_name: ''
      password: ''
      openssl_verify_mode: 'none'

标签: ruby-on-railsactionmailerredmine

解决方案


From外发邮件中的地址未在管理设置邮件通知configuration.yml的Web界面中配置。

在这里,管理员可以设置他们想要的From地址。设置存储在数据库中。


推荐阅读