0

I'm using mailboxer to send email notifications and if I do this:

def mailboxer_email(object)
  return "me@gmail.com"
end

It works perfectly, but I'm trying to return the user's email and I tried this:

def mailboxer_email(object)
  return "#{User.email}"    
end

I get the error:

NoMethodError (undefined method `email' for #<Class:0x0000000402c138>):

when I tried this:

def mailboxer_email(object)
  return :email
end

the logs read

"sent mail to email"

I also tried

def mailboxer_email(object) 
  return object.email     
end

but gives me

NoMethodError (undefined method `email' for #<Message:0x000000039f0530>): 
Gaurav Sharma
  • 477
  • 9
  • 24
franklinexpress
  • 1,149
  • 14
  • 44

1 Answers1

0

This method solved it, it was just passing email without " : "

def mailboxer_email(object)
  return email  # instead of return :email
end
Gaurav Sharma
  • 477
  • 9
  • 24
franklinexpress
  • 1,149
  • 14
  • 44