mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Add reply-to to e-mail headers by default. Closes #474
This commit is contained in:
parent
29e9be92b0
commit
ff0b4deb1a
4 changed files with 24 additions and 9 deletions
|
@ -18,8 +18,7 @@ class Devise::Mailer < ::ActionMailer::Base
|
||||||
|
|
||||||
# Configure default email options
|
# Configure default email options
|
||||||
def setup_mail(record, action)
|
def setup_mail(record, action)
|
||||||
initialize_from_record record
|
initialize_from_record(record)
|
||||||
|
|
||||||
mail headers_for(action)
|
mail headers_for(action)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,6 +43,10 @@ class Devise::Mailer < ::ActionMailer::Base
|
||||||
headers.merge!(resource.headers_for(action))
|
headers.merge!(resource.headers_for(action))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless headers.key?(:reply_to)
|
||||||
|
headers[:reply_to] = headers[:from]
|
||||||
|
end
|
||||||
|
|
||||||
headers
|
headers
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,10 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
|
||||||
assert_equal ['test@example.com'], mail.from
|
assert_equal ['test@example.com'], mail.from
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'setup reply to as copy from sender' do
|
||||||
|
assert_equal ['test@example.com'], mail.reply_to
|
||||||
|
end
|
||||||
|
|
||||||
test 'setup subject from I18n' do
|
test 'setup subject from I18n' do
|
||||||
store_translations :en, :devise => { :mailer => { :confirmation_instructions => { :subject => 'Account Confirmation' } } } do
|
store_translations :en, :devise => { :mailer => { :confirmation_instructions => { :subject => 'Account Confirmation' } } } do
|
||||||
assert_equal 'Account Confirmation', mail.subject
|
assert_equal 'Account Confirmation', mail.subject
|
||||||
|
|
|
@ -38,6 +38,10 @@ class ResetPasswordInstructionsTest < ActionMailer::TestCase
|
||||||
assert_equal ['test@example.com'], mail.from
|
assert_equal ['test@example.com'], mail.from
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'setup reply to as copy from sender' do
|
||||||
|
assert_equal ['test@example.com'], mail.reply_to
|
||||||
|
end
|
||||||
|
|
||||||
test 'setup subject from I18n' do
|
test 'setup subject from I18n' do
|
||||||
store_translations :en, :devise => { :mailer => { :reset_password_instructions => { :subject => 'Reset instructions' } } } do
|
store_translations :en, :devise => { :mailer => { :reset_password_instructions => { :subject => 'Reset instructions' } } } do
|
||||||
assert_equal 'Reset instructions', mail.subject
|
assert_equal 'Reset instructions', mail.subject
|
||||||
|
|
|
@ -38,6 +38,10 @@ class UnlockInstructionsTest < ActionMailer::TestCase
|
||||||
assert_equal ['test@example.com'], mail.from
|
assert_equal ['test@example.com'], mail.from
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'setup reply to as copy from sender' do
|
||||||
|
assert_equal ['test@example.com'], mail.reply_to
|
||||||
|
end
|
||||||
|
|
||||||
test 'setup subject from I18n' do
|
test 'setup subject from I18n' do
|
||||||
store_translations :en, :devise => { :mailer => { :unlock_instructions => { :subject => 'Yo unlock instructions' } } } do
|
store_translations :en, :devise => { :mailer => { :unlock_instructions => { :subject => 'Yo unlock instructions' } } } do
|
||||||
assert_equal 'Yo unlock instructions', mail.subject
|
assert_equal 'Yo unlock instructions', mail.subject
|
||||||
|
|
Loading…
Reference in a new issue