Net::SMTPAuthenticationError (530 5.7.0 Must issue a STARTTLS command first. 23s

在配置发送邮件设置的时候
ActionMailer::Base.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'gmail.com',
:authentication => :plain,
:user_name => '***帐号不带@gmail.com****', #例如abc@gmail.com 只写abc
:password => '***密码***',
:enable_starttls_auto => true:cram_md5
}

Net::SMTPAuthenticationError (530 5.7.0 Must issue a STARTTLS command first. 23sm1922646pzk.0

在邮件配置的时候总是出现这种问题,后台经过学习,需要增加一个smtp-tls gem包

1、安装方法 :
sudo gem install ambethia-smtp-tls -v '1.1.2' --source http://gems.github.com

2、如果是rails 3
Gemfile要写如下:
gem 'ambethia-smtp-tls'

3、然后如下写:
[color=red]require 'smtp-tls'[/color]
RailsCoders::Application.configure do
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'gmail.com',
:authentication => :plain,
:user_name => '***帐号不带@gmail.com****', #例如abc@gmail.com 只写abc
:password => '***密码***',
:enable_starttls_auto => true
}

这样就可以发送了。

原文地址:http://railsforum.com/viewtopic.php?id=34622
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值