0
我試圖通過實施行動郵件中相關的代碼導軌發送郵件..行動郵件錯誤提供電子郵件
我郵寄/ user_mailer.rb
class UserMailer < ActionMailer::Base
default :from => "[email protected]"
def registration_confirmation(user)
mail(:to=>user.email, :subject =>"Registered")
end
end
users.controller是
def create
@user = User.new(user_params)
respond_to do |format|
if @user.save
UserMailer.registration_confirmation(@user).deliver
format.html { redirect_to @user, notice: 'User was successfully created.' }
format.json { render :show, status: :created, location: @user }
else
format.html { render :new }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
此處,您的初始化程序\ setup_mail.rb設置將轉到development.rb
config.action_mailer.default_url_options = { host: 'localhost', port: 9292 }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address =>"smtp.thejaingroup.com",
:domain =>"thejaingroup.com",
:port => 587,
:user_name =>"[email protected]",
:password =>"************"
:authentication =>"plain"
}
和我的看法是.. user_registration.text.erb ---是
Hi sir you successfully Completed signed..........!
我有錯誤味精運行此版本之後.. SocketError在UsersController#創建 的getaddrinfo:請求的名稱有效,但沒有找到所請求類型的數據。
問題是連接smtp服務器。應用程序無法連接服務器。 –