Search code examples
ruby-on-railsrubyherokusidekiq

NameError: uninitialized constant Mail::Parsers::ContentTransferEncodingParser


Sometimes when I send mass email on heroku some of them fail with the following error: NameError: uninitialized constant Mail::Parsers::ContentTransferEncodingParser

I have no idea why is that but I think that maybe this maybe caused by using attachments.inline in mailer. Any ideas what may cause this problem?


Solution

  • I create initializer with following line:

    Mail.eager_autoload! if Rails.env.production? && defined?(Mail)
    

    and that fixes the problem.