在rails app中手动发送特定页面的电子邮件

我有一个基本的应用程序,每季度为客户收集储蓄数据。 有一个视图显示每个客户端的数据与其他带有图表和图形的客户端数据的比较。 我正在寻找一种简单的方法来实现一个按钮(或其他东西),允许我根据自己的判断手动将该视图发送到客户端。 我只找到了如何在注册或确认类型的电子邮件中发送电子邮件的教程。

# app/mailers/user_mailer.rb class UserMailer < ActionMailer def report @things = Thing.report_stuff mail :to => 'boss@example.com', :from => 'you@example.com', :subject => 'that report you want' end end # app/views/user_mailer/report.html.erb 

Report

<% @things.each do |thing| %> <%= thing.name %> <% end %> # app/controllers/reports_controller.rb def create UserMailer.report.deliver flash[:notice] = 'report sent!' redirect_to root_path # or wherever end # in a view <% form_tag(reports_path, :method => :post) do %> <% submit_tag 'send report email' %> <% end %>