I'm looking at this tutorial http://guides.rubyonrails.org/action_mailer_basics.html and I get why it would send the html page that is in the view. However how do I send a page that already exists before I created the mailer? I don't want to copy the html and the ruby code over because I don't want another copy of that code to have to maintain.
The page I want to email is an announcements page and there is already another view for the announcements page since it is accessible from other parts of the site.
You can pass :template_path and :template_name hash keys to the specific method in your mailer as in:
mail(:to => user.email,
:subject => "Subject",
:template_path => 'announcements',
:template_name => 'index')
In this case it will look for templates at app/views/announcements with name index.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.