我有以下設置在標誌發送電子郵件了起來:Ruby on Rails的3:發送電子郵件幫助
的Rails 3.0.7
紅寶石1.9.2p180(2011-02-18修訂30909) x86_64的Linux的]
Rails插件安裝的git://github.com/collectiveidea/action_mailer_optional_tls.git
梅勒
class UserMailer < ActionMailer::Base
def registration_confirmation(user)
recipients user.email
from "[email protected]"
subject "Thank you for Registering"
body :user => user
end
end
控制器:
def create
@user = User.new(params[:user])
if @user.save
UserMailer.deliver_registration_confirmation(@user)
sign_in @user
flash[:success] = "Welcome to ECE"
redirect_to @user
else
@title = "Sign up"
render 'new'
end
end
查看:
Hi <%= @user.name %>, .....
我得到的SMTP連接錯誤,我谷歌搜索後,這包括在Gemfile中。
這解決了錯誤
的Gemfile
gem 'rack-ssl', :require => 'rack/ssl'
配置/環境/ development.rb
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.middleware.insert_before ActionDispatch::Static, "Rack::SSL"
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:authentication => :login,
:port => 587,
:domain => 'www.example.com',
:name => '[email protected]',
:password => 'password',
}
問題
早期的版本我WA獲得535-5.7.1用戶名和密碼不被接受。
現在它說:
SSL連接錯誤
無法建立到服務器的安全連接。這可能是服務器的問題,或者它可能需要您沒有的客戶端身份驗證證書。
錯誤107(net :: ERR_SSL_PROTOCOL_ERROR):SSL協議錯誤。
有什麼建議嗎?
我得到同樣的錯誤。昨晚我沒有得到這個錯誤。 – Wasi
也許嘗試:openssl_verify_mode =>'無'?你的SSL堆棧中的東西似乎有問題。 –
也嘗試過。 – Wasi