'Rails 7 send mail in production returns mail.delivery_method error undefined method `merge'

When I try to send any mail in production I get the following error.

gems/actionmailer-7.0.2.3/lib/action_mailer/delivery_methods.rb:65:in `wrap_delivery_behavior': undefined method `merge' for "25bcae06-5520-46c5-b1a4-83e6828df6c4":String (NoMethodError)

            mail.delivery_method(klass, (send(:"#{method}_settings") || {}).merge(options || {}))
                                                                           ^^^^^^

This error happens on every mailer, however to test this I used the following code in the console as a demonstration.

ActionMailer::Base.mail(
  from: "[email protected]", 
  to: "[email protected]", 
  subject: "Test", 
  body: "Test"
).deliver_now

Im using the following two gems which affect email. Roadie-rails postmark-rails.

I'm only using the Postmark gem in production.

In dev I'm able to send emails no problem. However, in production I get the above error.

What am I missing here? Why do I get this error only in production?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source