我是Rails noob,并且在显示页面发送电子邮件时遇到问题。这里有几个联系表格教程,但我找不到一个我从页面发送电子邮件的地方,比如'show'页面。我相信我的路线有很大的错误。在模型中,我声明用户有几个促销活动,并且在促销展示页面上,我希望允许current_user向@user发送电子邮件。Ruby on Rails:从显示页面发送电子邮件
这里是应用程序/邮寄/ quote_mailer.rb
class QuoteMailer < ActionMailer::Base
default :from => "[email protected]"
def quote_mail(promotion)
@user = user
mail(:to => user.email, :subject => "You have an inquiry homeboy!")
end
end
在promotions_controller我把这个行动,我认为可能是错误的:
def quotedeliver
QuoteMailer.quote_mail.deliver
flash[:notice] = 'report sent!'
redirect_to root_path # or wherever
end
这里是我用来发送表单电子邮件(:网址可能是错误的,但我不知道它应该如何看)
<%= form_for quote_mail, :url => quotedeliver_promotion_path(promotion), :html => {:method => :put } do |f| %>
<%= f.text_area :body %>
<%= f.submit %>
<% end %>
我会爱一些帮助。在stackoverflow上我找不到任何东西,我一直在尝试几天。谢谢!
请告诉我错误你越来越.. – 2012-04-24 04:45:21
什么是你的smtp设置在development.rb? – 2012-04-24 05:24:22