Get rid of tmail dependency.... #19

Closed
virtualfunction opened this Issue Nov 16, 2010 · 4 comments

3 participants

@virtualfunction

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.

@manveru
Official Rack repositories member

I'm not in favor of that, Mail depends on ActiveSupport.

@virtualfunction

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:

  • Just generating a raw email (don't really need a fully blown Mail API to do this imo given it's just a some headers and plain text)
  • Provide the option to use either mail or tmail.
@virtualfunction

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

@mpalmer

TMail is dead. Long live Mail!

@mpalmer mpalmer closed this Jun 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment