使用 Sendgrid 在 rails actionmailer url 中包含 www 子域

Include www subdomain in rails actionmailer urls with Sendgrid

我有一个 rails 5 应用程序,它使用 Sendgrid 发送电子邮件。这些电子邮件有指向应用程序的链接,例如 <%= link_to "Reply on platform"、conversation_url(@conversation) %>.

在我将我的 SSL 证书添加到该站点之前,这一切都运行良好且花花公子。现在,所有邮件程序链接都指向 https://domain.com, instead of simply domain.com. When visiting https://domain.com,该站点无法加载并抛出错误 "This site can’t be reached"。

这可能是我眼皮底下的一个简单修复,但我很难理解它。有什么建议吗?

在 config/environments/production.rb.

检查生产中的邮件程序配置

确保您有或添加一行内容如下: config.action_mailer.default_url_options = {主持人:"www.domain.com"}