使用 Rails 3 的 gmail smtp [英] gmail smtp with rails 3
本文介绍了使用 Rails 3 的 gmail smtp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 gmail 帐户发送确认电子邮件.我环顾四周,没有什么是显而易见的.没有错误或任何东西,只是不发送
I am trying to get a confirmation email sending using a gmail account. I have looked around and there is nothing that is obvious. There is no errors or anything, it just dosn't send
我把它作为初始化器:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "<address>@gmail.com",
:password => "<password>",
:authentication => "plain",
:enable_starttls_auto => true
}
ActionMailer::Base.default_url_options[:host] = "localhost:3000"
推荐答案
至少在 Rails 3.2 中你不再需要 tlsmail
gem
You don't need tlsmail
gem anymore at least with Rails 3.2
这就够了
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'baci.lindsaar.net',
:user_name => '<username>',
:password => '<password>',
:authentication => 'plain',
:enable_starttls_auto => true }
来自全能指南 gmail 的 ActionMailer 配置
这篇关于使用 Rails 3 的 gmail smtp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文