mattdm
(Matthew Miller)
1월 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 설정 사이의 관계에 대해 완전히 이해하지 못하는 부분이 있습니다. 템플릿이 존재하는 경우 email_subject가 사용되지 않는 것처럼 보이지만, 템플릿이 없는 경우가 언제인지 정확히 알지 못합니다. 이 부분을 제외하면, 커스텀 헤더를 생성하는 함수가 동일한 템플릿 처리 방식을 사용한다면 이 방식이 작동할 것이며, 커스텀 헤더에 유용한 동적 정보를 포함할 수 있을 것입니다.
2개의 좋아요