Forum: Ruby on Rails problem with mailer in rails 3

Posted by Annapoorna R (Guest)
on 2011-08-04 11:48
(Received via mailing list)
hi..
i got problem with mailer
 i m done with
=> rails g mailer UserMailer
=> in usermailer : def signup_notification(user)
        @activation_url = 
BASE_URL+activate_user_path(user.activation_code)
          @user = user
mail(:to => user.email_id, :subject => "account activate instruction")


=> views/signup_notification.html.erb
   <%= activation_url %>


=> rails c
=> UserMailer
 i get UserMailer
=> UserMailer.signup_notification(@user).deliver
Posted by Ajit Singh (ajitscorpio)
on 2011-08-04 17:35
(Received via mailing list)
Annapoorna

here are the steps I follow for Notification stuff

1. have a user controller and model
2. create rails mailer: rails g mailer user_mailer
3. open app/mailers/user_mailer.rb and added following method

def signup_nofitication(user)
@user = user
end

it should work now.

goto console, and run

user = User.last
UserMailer.signup_nofitication(user).deliver

let me know if it works for you or not.. if not then post error
message as well.

Ajit
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.