qwlong 发表于 2013-1-28 09:30:20

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、然后如下写:
require 'smtp-tls'
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
页: [1]
查看完整版本: Net::SMTPAuthenticationError (530 5.7.0 Must issue a STARTTLS command first. 23s