在Rails 3和ActionMailer中,是否可以使用基于SSL的TLS发送电子邮件(不是StartTLS)? [英] In Rails 3 and ActionMailer, is it possible to send email using TLS over SSL (Not StartTLS)?

查看:69
本文介绍了在Rails 3和ActionMailer中,是否可以使用基于SSL的TLS发送电子邮件(不是StartTLS)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用ActionMailer从我的Rail应用程序发送电子邮件。我有一个要使用的现有邮件服务器,但是它仅在端口465上支持SSL / TLS。但是,它不支持StartTLS(通常在端口587上)。

I would like to use ActionMailer to send emails from my rail app. I have an existing mail server that I would like to use, however it only supports SSL/TLS on port 465. It does not, however, support StartTLS (typically on port 587).

有人可以提出实现此目标的方法吗?据我所知,目前还没有任何支持。我正在使用Rails 3.0.7。

Can anyone suggest a way of achieving this? As far as I can tell there is no support out of the box for this. I am using Rails 3.0.7.

推荐答案

是的,您可以指定:ssl选项。

Yes, you can specify the :ssl option.

config / environments / production.rb 文件中设置以下值:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
    address: 'mail.example.com',
    port: 465,
    domain: 'example.com',
    user_name: 'no-reply@example.com',
    password: 'password',
    authentication: 'plain',
    ssl: true,
}

与我的ISP(Bluehost)发送邮件。

This works with my ISP (Bluehost) for sending mail.

这篇关于在Rails 3和ActionMailer中,是否可以使用基于SSL的TLS发送电子邮件(不是StartTLS)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆