mattdm
(Matthew Miller)
8 يناير 2022، 4:31م
8
@simon قارن
# No point in adding a reply-to header if it is going to be identical
# to the from address/alias. If the from option is not present, then
# the default reply-to address is used.
result['Reply-To'] = from_value if from_value != alias_email(@opts[:from])
end
end
result.merge(MessageBuilder.custom_headers(SiteSetting.email_custom_headers))
end
def self.custom_headers(string)
result = {}
string.split('|').each { |item|
header = item.split(':', 2)
if header.length == 2
name = header[0].strip
value = header[1].strip
result[name] = value if name.length > 0 && value.length > 0
end
} unless string.nil?
result
بـ
elsif SiteSetting.unsubscribe_via_email_footer
"unsubscribe_link_and_mail"
else
"unsubscribe_link"
end
@template_args[:unsubscribe_instructions] = I18n.t(unsubscribe_string, @template_args)
end
end
end
def subject
if @opts[:template] &&
TranslationOverride.exists?(locale: I18n.locale, translation_key: "#{@opts[:template]}.subject_template")
augmented_template_args = @template_args.merge({
site_name: @template_args[:email_prefix],
optional_re: @opts[:add_re_to_subject] ? I18n.t('subject_re') : '',
optional_pm: @opts[:private_reply] ? @template_args[:subject_pm] : '',
optional_cat: @template_args[:show_category_in_subject] ? "[#{@template_args[:show_category_in_subject]}] " : '',
optional_tags: @template_args[:show_tags_in_subject] ? "#{@template_args[:show_tags_in_subject]} " : '',
topic_title: @template_args[:topic_title] ? @template_args[:topic_title] : '',
})
هناك بعض التعقيد مع القوالب مقابل إعداد email_subject الذي لا أفهمه تمامًا - يبدو أن الأخير لا يُستخدم إذا كان هناك قالب، ولكني لست متأكدًا من متى لا يكون هناك قالب! ولكن بصرف النظر عن ذلك، فإن الشيء الأساسي هو أنه إذا كانت الوظيفة التي بنت الرؤوس المخصصة تستخدم نفس القوالب، فسيعمل هذا ويمكن أن تحتوي الرؤوس المخصصة على معلومات ديناميكية مفيدة.
إعجابَين (2)