discourse/app/mailers/test_mailer.rb
Martin Brennan a6be4972a8
FIX: Use our header value instead of custom header on duplicates (#16711)
When we build and send emails using MessageBuilder and Email::Sender
we add custom headers defined in SiteSetting.email_custom_headers.
However this was causing errors in cases where the custom headers
defined a header that we already specify in outbound emails (e.g.
the Precedence: list header for topic/post emails).

This commit makes it so we always use the header value defined in Discourse
core if there is a duplicate, discarding the custom header value
from the site setting.

cf. https://meta.discourse.org/t/email-notifications-fail-if-duplicate-headers-exist/222960/14
2022-05-11 13:47:12 +10:00

10 lines
214 B
Ruby

# frozen_string_literal: true
class TestMailer < ActionMailer::Base
include Email::BuildEmailHelper
def send_test(to_address, opts = {})
build_email(to_address, template: 'test_mailer', **opts)
end
end