Hi,
I'm using ActionMailier 3.2.12 and Mail 2.4.4 on ruby 1.9.3p484 (we're supporting a legacy app)
I'm getting the exception "undefined method `get_best_compatible' for nil:NilClass" when the deliver method is called.
I tried googling the exception, but only found this this and it was never answered:
http://stackoverflow.com/questions/13844051/undefined-method-get-best-compatible-for-nilclass-appearing-randomlyHas anyone experience bug and found a fix for it?
//this is our mailer (omitted actual emails):
class Notifications < ActionMailer::Base
default :from => "
te...@test.com"
def email_sanity_check(sent_at = Time.now)
@body_text = "sending you a test email at #{sent_at}"
mail(to: '
kao....@test.com',
body: @body_text,
content_type: "text/html",
subject: "email testing")
end
end
//code used in controller:
Notifications.email_sanity_check.deliver
exception:
undefined method `get_best_compatible' for nil:NilClass
backtrace:
/opt/rh/ruby193/root/usr/local/share/gems/gems/mail-2.4.4/lib/mail/body.rb:143:in `get_best_encoding'
/opt/rh/ruby193/root/usr/local/share/gems/gems/mail-2.4.4/lib/mail/body.rb:156:in `encoded'
/opt/rh/ruby193/root/usr/local/share/gems/gems/mail-2.4.4/lib/mail/message.rb:1710:in `encoded'
/opt/rh/ruby193/root/usr/local/share/gems/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:434:in `set_payload_for_mail'
/opt/rh/ruby193/root/usr/local/share/gems/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:414:in `block in deliver_mail'
/opt/rh/ruby193/root/usr/local/share/gems/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `block in instrument'
/opt/rh/ruby193/root/usr/local/share/gems/gems/activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/rh/ruby193/root/usr/local/share/gems/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `instrument'
/opt/rh/ruby193/root/usr/local/share/gems/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:413:in `deliver_mail'
/opt/rh/ruby193/root/usr/local/share/gems/gems/mail-2.4.4/lib/mail/message.rb:229:in `deliver'
/var/www/subs-app/app/controllers/emails_controller.rb:67:in `email_test'
.
.
.
Thanks,
Kao