Current version I am using is: Ruby = 1.8.7, rails = 2.3.2
I wrote sending mails function. While I am running I got the below error"
undefined method `default' for UserMailer:Class
my UserMailer
class:-
default :from => "example@gmail.com"
def welcome_email(user)
@user = params[:user]
@url = 'http://example.com/login'
mail(:to => "test123@gmail.com", :subject => "Test")
end
end
How to solve this issue?
Thank you.
undefined method `default' for UserMailer:Class
The method default
as well as mail
for the ActionMailer
are not introduced in Rails 2.3, so you can't use them. The Rails 2.3 syntax for your code would look like below
def welcome_email(user)
@user = params[:user]
@url = 'http://example.com/login'
recipients "test123@gmail.com"
from "example@gmail.com"
subject "Test"
sent_on Time.now
body {:user => @user, :url => @url}
end