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服务器。应用程序无法连接服务器。 –