How to send an email with rails

天涯浪子 提交于 2019-12-01 20:47:51

问题


This is probably very straight forward and simple, but I'm very new and noob at ruby on rails. I have a simple email php script that I used on an older website, but now since I've converted to rails I'm not sure as to how to create the equivalent to that.

I tried using rails generate mailer Notifier and then inside of that added a welcome method which sent and email. However in the User controller (under create so that when a user made an account their email address was sent a welcome email) i just got an error that said Notifier wasn't declared.

In the user controller I had

if @user.save
  Notifier.welcome(@user).deliver
end

this did not work


回答1:


Rails guides could rescue you.




回答2:


I suggest reading Action Mailer Guide



来源:https://stackoverflow.com/questions/6643381/how-to-send-an-email-with-rails

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