Commit a89e9736 authored by Semyon Pupkov's avatar Semyon Pupkov

Set `Auto-Submitted: auto-generated` header to emails

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/20305
parent 5e952962
---
title: Set Auto-Submitted header to mails
merge_request:
author: Semyon Pupkov
ActionMailer::Base.register_interceptor(AdditionalEmailHeadersInterceptor)
class AdditionalEmailHeadersInterceptor
def self.delivering_email(message)
message.headers(
'Auto-Submitted' => 'auto-generated',
'X-Auto-Response-Suppress' => 'All'
)
end
end
require 'spec_helper'
describe AdditionalEmailHeadersInterceptor do
it 'adds Auto-Submitted header' do
mail = ActionMailer::Base.mail(to: 'test@mail.com', from: 'info@mail.com', body: 'hello').deliver
expect(mail.header['To'].value).to eq('test@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['X-Auto-Response-Suppress'].value).to eq('All')
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