【问题标题】:Mail sending issue using dreamhost with ruby on rails使用带有 ruby​​ on rails 的 Dreamhost 发送邮件问题
【发布时间】:2017-08-29 11:58:37
【问题描述】:

我正在尝试使用 Dreamhost 凭据和 ruby​​ on rails 发送邮件。

我的 development.rb 文件邮件设置如下。

config.action_mailer.smtp_settings = {
  address: "dreamhost.com",
  port: 587,
  domain: "www.dreamhost.com",
  authentication: "plain",
  enable_starttls_auto: true,
  user_name: ENV['mailer'],
  password: ENV['mailer_password']
}

邮件无法使用上述邮件配置发送我收到类似 Errno::ECONNREFUSED 的错误(“dreamhost.com”端口 587 的连接被拒绝)。

谁能帮我解决这个问题?

【问题讨论】:

  • 有什么问题?您需要提供更多详细信息以供任何人帮助您。
  • 我没有得到确切的问题。我在 config/development.rb 文件中添加了邮件凭据和域设置。当我使用 Dreamhost 凭据发送邮件时,我不确定必须在地址和域中添加什么。

标签: ruby-on-rails ruby


【解决方案1】:

这是我在 Dreamhost 上使用的个人资料

  config.action_mailer.perform_caching = false

  # Ignore bad email addresses and do not raise email delivery errors.
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
  config.action_mailer.raise_delivery_errors = false

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_options = {from: 'notifications@mywebsite.org'}
  config.action_mailer.smtp_settings = {
  address:              'sub5.mail.dreamhost.com',
  port:                 587,
  domain:               'mywebsite.org',
  user_name:            'notifications@mywebsite.org',
  password:             'mypassword',
  authentication:       :login,
  enable_starttls_auto: false  }

请注意,sub5.mail.dreamhost.com 是您的datacenter server 的域相关地址。

注意:密码应该隐藏在ENV variables or other external file outside version control

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-06
    • 2016-12-18
    • 2012-01-20
    • 2023-03-28
    • 2011-01-24
    相关资源
    最近更新 更多