ruby-on-rails - 在 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'
解决方案
From
外发邮件中的地址未在管理➡设置➡邮件通知configuration.yml
的Web界面中配置。
在这里,管理员可以设置他们想要的From
地址。设置存储在数据库中。
推荐阅读
- jquery - 如何在 jquery 'each' 循环中对 json 值进行分组和排序
- mysql - 无法在我的实时服务器上维护数据库连接,在本地工作正常。节点.js + mysql
- vue.js - Vuejs:如何在创建的钩子中获取计算属性
- c# - 尽管输入不同,但从 foreach 循环返回相同的值
- php - 显示表中的所有行,但首先显示 id=x - PHP 和 MySQL
- python - Python - 从第 n 个元素开始打印分割线
- javascript - React Native - 在静态函数中使用状态变量
- sql - ORACLE:不是 GROUP BY 表达式
- ssl - Magento 1.9 页面在没有 index.php 的情况下无法加载
- angular - 将当前 Observable 流的上下文发送到另一个组件