diff --git a/lib/rodauth/rails.rb b/lib/rodauth/rails.rb index c670783..599ea8d 100644 --- a/lib/rodauth/rails.rb +++ b/lib/rodauth/rails.rb @@ -10,6 +10,7 @@ class Error < StandardError # This allows avoiding loading Rodauth at boot time. autoload :App, "rodauth/rails/app" autoload :Auth, "rodauth/rails/auth" + autoload :Mailer, "rodauth/rails/mailer" @app = nil @middleware = true diff --git a/lib/rodauth/rails/feature/email.rb b/lib/rodauth/rails/feature/email.rb index d25fafd..d0c7367 100644 --- a/lib/rodauth/rails/feature/email.rb +++ b/lib/rodauth/rails/feature/email.rb @@ -12,20 +12,13 @@ module Email # Create emails with ActionMailer which uses configured delivery method. def create_email_to(to, subject, body) - Mailer.create_email(to: to, from: email_from, subject: "#{email_subject_prefix}#{subject}", body: body) + Rodauth::Rails::Mailer.create_email(to: to, from: email_from, subject: "#{email_subject_prefix}#{subject}", body: body) end # Delivers the given email. def send_email(email) email.deliver_now end - - # ActionMailer subclass for correct email delivering. - class Mailer < ActionMailer::Base - def create_email(options) - mail(options) - end - end end end end diff --git a/lib/rodauth/rails/mailer.rb b/lib/rodauth/rails/mailer.rb new file mode 100644 index 0000000..c61de1c --- /dev/null +++ b/lib/rodauth/rails/mailer.rb @@ -0,0 +1,9 @@ +module Rodauth + module Rails + class Mailer < ActionMailer::Base + def create_email(options) + mail(options) + end + end + end +end