666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
|
# File 'app/models/mailer.rb', line 666
def mail(={}, &block)
begin
mail_from = Mail::Address.new(Setting.mail_from)
if mail_from.display_name.blank? && mail_from..blank?
mail_from.display_name =
@author&.logged? ? @author.name : Setting.app_title
end
from = mail_from.format
from_addr = mail_from.address.to_s
project_identifier = self.['X-Redmine-Project']&.value
list_id = if project_identifier.present?
"<#{project_identifier}.#{from_addr.tr('@', '.')}>"
else
"<#{from_addr.tr('@', '.')}>"
end
rescue Mail::Field::IncompleteParseError
from = Setting.mail_from.to_s
list_id = "<#{from.tr('@', '.')}>"
end
.reverse_merge! 'X-Mailer' => 'Redmine',
'X-Redmine-Host' => Setting.host_name,
'X-Redmine-Site' => Setting.app_title,
'X-Auto-Response-Suppress' => 'All',
'Auto-Submitted' => 'auto-generated',
'From' => from,
'List-Id' => list_id
[:to, :cc, :bcc].each do |key|
if [key].present?
[key] = self.class.email_addresses([key])
end
end
if @author&.logged? && @author.pref.no_self_notified
addresses = @author.mails
[:to] -= addresses if [:to].is_a?(Array)
[:cc] -= addresses if [:cc].is_a?(Array)
end
if @author&.logged?
'Sender' => @author.login
end
if @message_id_object
[:message_id] = "<#{self.class.message_id_for(@message_id_object, @user)}>"
end
if @references_objects
[:references] = @references_objects.collect {|o| "<#{self.class.references_for(o, @user)}>"}.join(' ')
end
if block
super
else
super do |format|
format.text
format.html unless Setting.plain_text_mail?
end
end
end
|