After setting up mailer (3.2.6) in Ruby on rails (3.2.6) I get this error:
NoMethodError (undefined method `mail' for #):
my user_mailer.rb looks like this:
class UserMailer < ActionMailer::Base
default :from => "[email protected]"
def activation_mail(user)
@user = user
mail(:to => user.mail, :subject => "Registration")
end
end
I followed example provided here: http://guides.rubyonrails.org/action_mailer_basics.html
In configuration file I added this line: config.action_mailer.delivery_method = :test I also tried with :smtp and configuration for gmail.
What have I missed?
I had a similar problem recently and rectified it by replacing:
def self.activation_mail()
with
def activation_mail()
you should try replacing
def activation_mail(user)
@user = user
mail(:to => user.mail, :subject => "Registration")
end
with
def activation_mail(user)
@user = user
mail(:to => @user.mail, :subject => "Registration")
end
It's a typo error. Your user.mail doesn't exist. Maybe it should be user.email or something else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With