Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Get rid of tmail dependency.... #19
TMail is a nasty turd pile of poop ;-)
Rack::MailExceptions should be updated to use the new mail gem like ActionMailer 3.x uses. It's a fairly simple fix (I've got a monkey patched version... I can clean it up and update the tests and throw over a pull request).
The main reason for the dependency change is that many Ruby 1.9 users will have issues with TMail (unless they are using the hacked version shipped in in ActionMailer 2.x). The new mail gem works fine on all Ruby versions and with many people now migrating to Rails 3.x and Ruby 1.9 it makes sense to update this.
While ExceptionNotifier exists, it's Rack support was added as an afterthought, and depending on bits of Rails which is not good for users of Sinatra, etc. Further more ExceptionNotifier is not maintained and thus if Rack::MailExceptions was updated, it would be good to encourage users to migrate to it as this works seamlessly across all Rack apps.
OK, good point.
Have you got any suggestions to any alternatives? A lot of people are now looking at dabbling in Ruby 1.9 and therefore the TMail dependency is real PITA.
Other options that spring to my mind are:
Given I want to ditch exception notifier, I've dug up rack-contrib again.
Given that Tmail is royally broken in Ruby 1.9 (all the versions I try are mess up big time), and many people are starting to adopt 1.9 I really think there needs to be the option to not be tied to Tmail. Obviously both Mail and Tmail have their cavets, but seem to use the same API in terms of method calls.
I think it would be helpful to abstract away the mail creation so either could be used. Given both have more-less the same API for now, it's merely a matter of changing "mail = TMail::Mail.new" in Rack::MailExceptions#generate_mail.
while it's still a bit dirty, something like:
def mail_api if :tmail == config[:api] || ! defined?(::Mail) TMail::Mail else Mail end end
then changing "mail = TMail::Mail.new" to "mail = mail_api.new" should get round the issue and allow people utilise Rack::MailExceptions as this is far more framework agnostic than exception_notifier, which does exactly the same thing