In section 2.1.1 of the Action Mailer Basics Guide, the following code snippet is provided for setting up a basic action mailer:
app/mailers/application_mailer.rb
class ApplicationMailer < ActionMailer::Base
default “from@example.com”
layout ‘mailer’
end
app/mailers/user_mailer.rb
class UserMailer < ApplicationMailer
end
Unfortunately this results in a TypeError of “no implicit conversion of String into Hash” because the default configuration method expects to receive a hash and not a string (see ActionMailer::Base). Instead, it appears that the following needs to be use:
app/mailers/application_mailer.rb
class ApplicationMailer < ActionMailer::Base
default from: “from@example.com”
layout ‘mailer’
end
app/mailers/user_mailer.rb
class UserMailer < ApplicationMailer
end
This is also consistent with the similar code snippet provided in section 2.1.2.
If I’ve misunderstood something here, just let me know. Thanks.