Mailer SMTP 已经设 587 但是错误却是写 localhost 25 正常吗?

lulalala · February 11, 2018 · Last by lulalala replied at February 12, 2018 · 6207 hits

新安装了 ubuntu 在 vultr 上,要寄信时都会出错:

Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 25

我很确定我上面跑的 production 环境是用 sendgrid 所要求的 port 587 从 production 的 rails console 看到的都是正确连到 sendgrid 的设定。

后来发现自己没有装 postfix,装了以后这个问题就消失了。

所以想来确认一下自己理解对不对: ActionMailer 就算是设定好 SMTP port 了, 他还是会透过 localhost:25 跟像是 postfix 之类的 MTA 接触,之后才会用设定的 port 往 sendgrid 连?

原来一定要用 symbol key 不能用 string key

不需要装 MTA

You need to Sign in before reply, if you don't have an account, please Sign up first.