Why am i getting 'uninitialized constant Mail::TestMailer' error with "Rails 6.1.5 & Ruby 3.1.0" while working without problems "Rails 6.1.5 & Ruby 3.0.1" ?
Rails 6.1.5: uninitialized constant Mail::TestMailer
Asked Answered
think you should move your answer to the answers :) you can self-answer questions :) –
Vladimar
see stackoverflow.com/help/self-answer –
Vladimar
Found following from NEWS for Ruby 3.1.0.
The following default gems are now bundled gems.
net-ftp 0.1.3
net-imap 0.2.2
net-pop 0.1.1
net-smtp 0.3.1
matrix 0.4.2
prime 0.1.2
debug 1.4.0
So, i just added next 3 lines into GemFile. It worked fine.
gem 'net-smtp' # to send email
gem 'net-imap' # for rspec
gem 'net-pop' # for rspec
I had similar issue, after debugging and troubleshooting. I made changes to the Rails version to 6.1.1.4 instead of 6.1.7. The I got similar error stating that it could not load some .rb files from the mail gem. What I did was to give them the read permission to others.
chmod 644 <ruby-file-in-mail-gem>.rb
and the application loaded fine after that.
I was getting same issue after deploying the code on server.
Version details-
Rails 6.1.5
ruby 3.1.2p20
I just install a new gem as-
gem 'net-smtp'
and issue got resolved.
© 2022 - 2024 — McMap. All rights reserved.