Commit 93ae3063 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'add-auto-submited-header' into 'master'

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

Closes #20305

See merge request !9163
parents 8b955e4e a89e9736
---
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