Rails Cast:ActionMailer电子邮件未发送到收件箱
|
服务器指出电子邮件已发送到正确的地址,但是收件箱中没有收到该消息。
我的Setup_mail.rb文件
ActionMailer::Base.smtp_settings ={
:address => \"smtp.gmail.com\",
:port => 587,
:domain => \"gmail.com\",
:user_name => \"my_user_name@gmail.com\",
:password => \"my_password\",
:authentication => \"Plain\",
:enable_starttls_auto => true
}
我的development.rb
文件是:
# Don\'t care if the mailer can\'t send
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true #default value
config.action_mailer.delivery_method = :smtp #default value
我的test.rb
文件是:
config.action_mailer.delivery_method = :smtp
我尝试了多种变体,但迷路了。我在Windows 7计算机上运行。我正在运行Ruby 1.8.7和Rails 3.0.7
有人可以帮忙吗?
这是我的创建方法:
def create
@user = User.new(params[:user])
if @user.save
UserMailer.registration_confirmation(@user).deliver
sign_in @user
redirect_to @user, :flash => { :success => \"Welcome to the Sample App!\" }
else
@title = \"Sign up\"
render \'new\'
end
end
我的user_mailer.rb
类UserMailer default :from => \"my_user_name@gmail.com\" def registration_confirmation(user) mail(:to => user.email, :subject => \"Thanks for registering\") end end
没有找到相关结果
已邀请:
5 个回复
蜗仓馈
咳累录酬
。这为我解决了这个问题:
课刊灭似
瓜唱鬼
臂哦