summaryrefslogtreecommitdiffstats
path: root/test/unit/mailer_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-04-08 13:28:34 +0000
committerGo MAEDA <maeda@farend.jp>2019-04-08 13:28:34 +0000
commitce6e9ca95062465b14a425340923493b15fe903e (patch)
treee63f2ced10347079b9c64e33a1f534abce4eb73c /test/unit/mailer_test.rb
parentcae8905b7c835df863656b4bb2c6b8cb223a198d (diff)
downloadredmine-ce6e9ca95062465b14a425340923493b15fe903e.tar.gz
redmine-ce6e9ca95062465b14a425340923493b15fe903e.zip
Don't raise an exception when the emission email address is not RFC compliant (#5913).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@18050 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/mailer_test.rb')
-rw-r--r--test/unit/mailer_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb
index 51fc001f9..418d8ad69 100644
--- a/test/unit/mailer_test.rb
+++ b/test/unit/mailer_test.rb
@@ -252,6 +252,18 @@ class MailerTest < ActiveSupport::TestCase
assert_equal 'Redmine app <redmine@example.net>', mail.header['From'].to_s
end
+ def test_from_header_with_rfc_non_compliant_phrase
+ # Send out the email instead of raising an exception
+ # no matter if the emission email address is not RFC compliant
+ assert_nothing_raised do
+ with_settings :mail_from => '[Redmine app] <redmine@example.net>' do
+ Mailer.deliver_test_email(User.find(1))
+ end
+ end
+ mail = last_email
+ assert_match /<redmine@example\.net>/, mail.from_addrs.first
+ assert_equal '[Redmine app] <redmine@example.net>', mail.header['From'].to_s
+ end
def test_from_header_with_author_name
# Use the author's name or Setting.app_title as a display name
# when Setting.mail_from does not include a display name