【问题标题】:Rails - Is Sendmail or Postfix Installation required for External SMTP ServerRails - 外部 SMTP 服务器是否需要安装 Sendmail 或 Postfix
【发布时间】:2018-07-21 19:28:51
【问题描述】:

所以我使用 Sendgrid,一个处理交易电子邮件的外部 SMTP 服务器。

我刚刚在一个全新的 VPS 上部署了我的 Rails 应用程序,上面装有 Ubuntu。

Sendgrid tutorial 中,我看到我只需将 ActionMailer 设置为使用正确的用户名/密码指向 sendgrid 的 SMTP 地址。

但我遇到了Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 25 错误,但我确定我已将其设置为指向 Sendgrid 的 587 端口。我在网上搜索,有人建议我安装postfix。我猜 ActionMailer 需要本地主机上的 MTA。

sendmail 或 postfix 是在 Linux 上使用外部 SMTP 服务所需的软件包吗?

【问题讨论】:

  • 你能显示 SMTP 配置吗?
  • 你能显示 config.action_mailer.delivery_method 设置吗?
  • 还有 config.action_mailer.default_url_options 设置?

标签: ruby-on-rails email sendmail actionmailer sendgrid


【解决方案1】:

答案是否定的,不需要 postfix 或 sendmail。

ActionMailer/Mailer gem 可以直接连接到远程 SMTP 服务器。


附带说明,我的本地主机问题是配置哈希的键以某种方式转换为字符串键。将其转换为符号键解决了这个问题。

【讨论】:

    猜你喜欢
    • 2015-06-01
    • 2020-09-03
    • 1970-01-01
    • 2015-06-18
    • 2018-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-09
    相关资源
    最近更新 更多