##// END OF EJS Templates
Mailer.token_for generates invalid message_id when using from address with full name (#16619)....
Jean-Philippe Lang -
r12851:53deb6ca880d
parent child
Show More
@@ -464,7 +464,7 class Mailer < ActionMailer::Base
464 if rand
464 if rand
465 hash << Redmine::Utils.random_hex(8)
465 hash << Redmine::Utils.random_hex(8)
466 end
466 end
467 host = Setting.mail_from.to_s.gsub(%r{^.*@}, '')
467 host = Setting.mail_from.to_s.strip.gsub(%r{^.*@|>}, '')
468 host = "#{::Socket.gethostname}.redmine" if host.empty?
468 host = "#{::Socket.gethostname}.redmine" if host.empty?
469 "#{hash.join('.')}@#{host}"
469 "#{hash.join('.')}@#{host}"
470 end
470 end
@@ -650,6 +650,12 class MailerTest < ActiveSupport::TestCase
650 assert ActionMailer::Base.perform_deliveries
650 assert ActionMailer::Base.perform_deliveries
651 end
651 end
652
652
653 def test_token_for_should_strip_trailing_gt_from_address_with_full_name
654 with_settings :mail_from => "Redmine Mailer<no-reply@redmine.org>" do
655 assert_match /\Aredmine.issue-\d+\.\d+\.[0-9a-f]+@redmine.org\z/, Mailer.token_for(Issue.generate!)
656 end
657 end
658
653 def test_layout_should_include_the_emails_header
659 def test_layout_should_include_the_emails_header
654 with_settings :emails_header => "*Header content*" do
660 with_settings :emails_header => "*Header content*" do
655 with_settings :plain_text_mail => 0 do
661 with_settings :plain_text_mail => 0 do
General Comments 0
You need to be logged in to leave comments. Login now