Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
ActionMailer is awesome. The deficiency is all mine, but frankly I don't want to maintain a bunch of templates somewhere. I just want to have a string that I can email. This lets you send email directly and immediately without having to maintain the templates. We use it for managing automatic deploy emails from within capistrano. Let's see if we can get that down to 5 lines? action_mailer_with_temporary_delivery_method do mail = TMail::Mail.new mail.subject, = "email is awesome" mail.to, mail.from = "email@example.com", ActionMailer::Base.smtp_settings[:user_name] mail.date = Time.now mail.body = "Look ma, I'm sending email without bleeding" ActionMailer::Base.deliver(mail) end Ok, it's not 5 lines, someone would have to be clever and and wrap that with: def do_my_bidding action_mailer_with_temporary_delivery_method do mail = TMail::Mail.new mail = yield mail ActionMailer::Base.deliver(mail) end end do_my_bidding do |mail| mail.subject, = "email is awesome" mail.to, mail.from = "firstname.lastname@example.org", ActionMailer::Base.smtp_settings[:user_name] mail.date = Time.now mail.body = "Look ma, I'm sending email without bleeding" mail end Knock yourselves out. Email shouldn't be hard. It's 2009. Email was hard when dinosaurs and glaciers raced each other to the equator. To install drop it into RAILS_ROOT/lib and require it from environment.rb --- The MIT License Copyright (c) 2009 Agora Games Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.