如何发送电子邮件与rails [英] How to send an email with rails
问题描述
这可能很简单,但我在轨道上的红宝石是非常新的和noob。
我有一个简单的电子邮件php脚本,我在旧的网站上使用,但现在,因为我已经转换到rails我不知道如何创建相当于。
我尝试使用 rails生成邮件通知程序
,然后在其中添加了一个发送和电子邮件的欢迎方法。然而,在用户控制器(在创建下,使得当用户创建一个帐户时,他们的电子邮件地址被发送了一封欢迎电子邮件),我刚刚收到一条错误,表示Notifier未声明。
在用户控制器中,我有
if @ user.save
Notifier.welcome(@user)。交付
结束
这没有工作
Rails指南可以拯救你。 / p>
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
Rails guides could rescue you.
这篇关于如何发送电子邮件与rails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!