Log the following information in email headers: * X-Danbooru-User: the user's name and ID. * X-Danbooru-IP: the user's IP. * X-Danbooru-Session: the users' session ID. * X-Danbooru-URL: the page that triggered the email. * X-Danbooru-Job-Id: the ID of the background job that sent the email. * X-Danbooru-Enqueued-At: when the email was queued as a background job. * X-Danbooru-Dmail: for Dmail notifications, the link to the Dmail. * X-Request-Id: the request ID of the HTTP request that triggered the email. Also make it so we log an event in the APM when we send an email.
12 lines
422 B
Ruby
12 lines
422 B
Ruby
# frozen_string_literal: true
|
|
|
|
# This is called just before an email is sent out to log information about the email.
|
|
#
|
|
# @see config/application.rb (config.action_mailer.interceptors)
|
|
# @see https://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails
|
|
class EmailDeliveryLogger
|
|
def self.delivering_email(email)
|
|
DanbooruLogger.info("Delivering email to #{email.to}", headers: email.headers)
|
|
end
|
|
end
|