diff --git a/app/mailers/invite_mailer.rb b/app/mailers/invite_mailer.rb index 2ef3a366c89..125eab3e3b8 100644 --- a/app/mailers/invite_mailer.rb +++ b/app/mailers/invite_mailer.rb @@ -2,7 +2,6 @@ require_dependency 'email_builder' class InviteMailer < ActionMailer::Base include EmailBuilder - default from: SiteSetting.notification_email def send_invite(invite) diff --git a/app/mailers/test_mailer.rb b/app/mailers/test_mailer.rb index 33a92fae152..418b91e3428 100644 --- a/app/mailers/test_mailer.rb +++ b/app/mailers/test_mailer.rb @@ -3,8 +3,6 @@ require_dependency 'email_builder' class TestMailer < ActionMailer::Base include EmailBuilder - default from: SiteSetting.notification_email - def send_test(to_address) build_email to_address, 'test_mailer' end diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index 25f37ae6452..1e40e789786 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -4,8 +4,6 @@ require_dependency 'email_builder' class UserNotifications < ActionMailer::Base include EmailBuilder - default from: SiteSetting.notification_email - def signup(user, opts={}) build_email(user.email, "user_notifications.signup", email_token: opts[:email_token]) end diff --git a/lib/email_builder.rb b/lib/email_builder.rb index 5f636eb2da7..2249865c4ba 100644 --- a/lib/email_builder.rb +++ b/lib/email_builder.rb @@ -19,8 +19,7 @@ module EmailBuilder subject: I18n.t("#{email_key}.subject_template", params), body: body } - mail_args[:from] = params[:from] if params[:from].present? - + mail_args[:from] = params[:from] || SiteSetting.notification_email mail(mail_args) end