I’m creating a Mail object in a Rails app and want it to pick the mailer settings:
original = UserMailer.new_registration
original.deliver# Does the job
custom = Mail.new(original.to_s)
custom.deliver # Fails: OpenSSL::SSL::SSLError: hostname does not match the server certificate
Apparently the custom Mail object isn’t picking up the Rails settings.
Looking at the code, we can pick up the config from the mailer the following way: