我想要的只是使用 SSL 通过 SMTP 从我的 ruby 脚本发送电子邮件。
我只找到了从 Rails 或使用 TLS 的 Gmail 执行此操作的示例。
我发现人们谈论 ruby 1.8.5 的 SMTPS 支持,但是libdoc http://www.ruby-doc.org/stdlib/libdoc/net/smtp/rdoc/classes/Net/SMTP.html没有提到它。
有人有在端口 465 上使用 SSL 通过 SMTP 发送邮件的示例吗?
ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
我用下面的配置解决了这个问题:
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'mail.domain.com',
:port => '465',
:domain => 'yourdomain.com',
:user_name => '[email protected] /cdn-cgi/l/email-protection',
:password => 'yourpassword',
:authentication => :login,
:ssl => true,
:openssl_verify_mode => 'none' #Use this because ssl is activated but we have no certificate installed. So clients need to confirm to use the untrusted url.
}
它对我来说非常有效。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)