facing problem in action mailer
facing problem in action mailer. my mailer is
def registration_confirmation(user)
subject "Password Reset Instructions"
from "sender_email_id@test.com"
recipients user.email
content_type "text/html"
body "RESET your Password"
end
Settings for mailer are
require 'development_mail_interceptor'
开发者_C百科ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "domain.in",
:user_name => "admin@domain.in",
:password => "PASSWORD",
:authentication => "plain",
:enable_starttls_auto => true
}
ActionMailer::Base.default_url_options[:host] = "localhost:3000"
Mail.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
and my controller is UserMailer.registration_confirmation(@new_user).deliver
The mail is not going to the user.email , it is always going to admin@domain.in
I am using mail-v 2.2.19 and rails 3.0.9
please help.
try adding this line(works for me):
mail(:to => user.email, :subject => "Password Reset Instructions")
to your registration_confirmation method
def registration_confirmation(user)
from "sender_email_id@test.com"
content_type "text/html"
body "RESET your Password"
mail(:to => user.email, :subject => "Password Reset Instructions")
end
精彩评论