Rails: Devise: post-confirmation error -
i trying send email event administrator, after user confirms.
see: rails: devise: sending email after user comfirms registration
i wrote eventmailer class follows:
class eventmailer < actionmailer::base @user = user @host_name = "localhost:3000" if rails.env.development? @host_name = "test.com" if rails.env.test? @host_name = "production.com" if rails.env.production? def self.send_email_to_admin @@smtp_settings = { #override default smtp settings since i'm using difference sender :address => "smtp.gmail.com", :port => 587, :domain => @host_name, :authentication => "plain", :enable_starttls_auto_=> true, :user_name => env["org_from"], :password => env["org_from_pwd"], :to => admin_recipients #admin_recipients defined elsewhere } mail(:subject => "invite request received " + @user.first.to_s + " " + @user.last.to_s) end end when users register, receive registration link. when click on link, following error message:
undefined method `mail' eventmailer:class app/mailers/event_mailer.rb:20:in `send_email_to_admin' app/controllers/confirmations_controller.rb:11:in `show' any ideas?
edit:
the solution move both :to , :from inside mail nethod
try moving :to => dent_admin_recipients mail method:
mail(:to => dent_admin_recipients, :subject => "invite request received " + @user.first.to_s + " " + @user.last.to_s)
Comments
Post a Comment