Commit 7e78db6e authored by Douwe Maan's avatar Douwe Maan

Merge branch...

Merge branch '39593-emails-on-push-are-sent-to-only-the-first-recipient-when-using-aws-ses' into 'master'

Resolve "Emails on Push are sent to only the first recipient when using AWS SES"

Closes #39593

See merge request gitlab-org/gitlab-ce!15083
parents e25acf24 eddc9e41
---
title: Only set Auto-Submitted header once for emails on push
merge_request:
author:
type: fixed
class AdditionalEmailHeadersInterceptor class AdditionalEmailHeadersInterceptor
def self.delivering_email(message) def self.delivering_email(message)
message.headers( message.header['Auto-Submitted'] ||= 'auto-generated'
'Auto-Submitted' => 'auto-generated', message.header['X-Auto-Response-Suppress'] ||= 'All'
'X-Auto-Response-Suppress' => 'All'
)
end end
end end
require 'spec_helper' require 'spec_helper'
describe AdditionalEmailHeadersInterceptor do describe AdditionalEmailHeadersInterceptor do
it 'adds Auto-Submitted header' do let(:mail) do
mail = ActionMailer::Base.mail(to: 'test@mail.com', from: 'info@mail.com', body: 'hello').deliver ActionMailer::Base.mail(to: 'test@mail.com', from: 'info@mail.com', body: 'hello')
end
before do
mail.deliver_now
end
it 'adds Auto-Submitted header' do
expect(mail.header['To'].value).to eq('test@mail.com') expect(mail.header['To'].value).to eq('test@mail.com')
expect(mail.header['From'].value).to eq('info@mail.com') expect(mail.header['From'].value).to eq('info@mail.com')
expect(mail.header['Auto-Submitted'].value).to eq('auto-generated') expect(mail.header['Auto-Submitted'].value).to eq('auto-generated')
expect(mail.header['X-Auto-Response-Suppress'].value).to eq('All') expect(mail.header['X-Auto-Response-Suppress'].value).to eq('All')
end end
context 'when the same mail object is sent twice' do
before do
mail.deliver_now
end
it 'does not add the Auto-Submitted header twice' do
expect(mail.header['Auto-Submitted'].value).to eq('auto-generated')
expect(mail.header['X-Auto-Response-Suppress'].value).to eq('All')
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment