2024-02-02 09:05:04 -06:00
|
|
|
class ApplicationMailer < ActionMailer::Base
|
|
|
|
layout "mailer"
|
2024-04-29 22:44:24 +02:00
|
|
|
|
2024-05-02 13:18:18 -04:00
|
|
|
after_action :set_self_host_settings, if: -> { Rails.configuration.app_mode.self_hosted? }
|
2024-04-29 22:44:24 +02:00
|
|
|
|
|
|
|
private
|
|
|
|
|
2024-08-23 10:06:24 -04:00
|
|
|
def set_self_host_settings
|
|
|
|
mail.from = Setting.email_sender
|
|
|
|
mail.delivery_method.settings.merge!({ address: Setting.smtp_host,
|
|
|
|
port: Setting.smtp_port,
|
|
|
|
user_name: Setting.smtp_username,
|
|
|
|
password: Setting.smtp_password,
|
|
|
|
tls: ENV.fetch("SMTP_TLS_ENABLED", "true") == "true" })
|
|
|
|
end
|
2024-02-02 09:05:04 -06:00
|
|
|
end
|