Rails - 外部 SMTP 服务器是否需要安装 Sendmail 或 Postfix

Rails - Is Sendmail or Postfix Installation required for External SMTP Server

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

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

Sendgrid tutorial 中,我看到我只需要将 ActionMailer 设置为指向带有正确 username/password.

的 sendgrid 的 SMTP 地址

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

在 Linux 上使用外部 SMTP 服务是否需要 sendmail 或 postfix 包?

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

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


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