[英]ActionMailer not sending emails, pass value in model
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>):
This method solved it, it was just passing email without " : " 这种方法解决了它,它只是通过不带“:”的电子邮件
def mailboxer_email(object)
return email # instead of return :email
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.