Rails Send 2 different emails from one mailer function

余生颓废 提交于 2019-12-05 06:33:30

Ok. So, silly me, I forgot to mention that I'm dealing with delayed_jobs gem. So, the problem was, that I forgot to specify the ".deliver!" action after each "mail" function.

So, it should look like this:

mail(:to => @vehicle.owner.email_address, :template_name => "n_o").deliver!
mail(:to => @vehicle.booker.email_address, :template_name => "n_b").deliver!

But still. Thank you for your support!

Try:

def notification(vehicle,template_name) 
  @vehicle = vehicle
  mail(:to => @vehicle.owner.email_address, :template_name => template_name)
end


Mailer.notification(@vehicle,"n_o").deliver 
Mailer.notification(@vehicle,"n_b").deliver 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!