mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 20:32:02 +08:00
Use an appropriate name in the Reply-To header
Use "Site Name <>" for the Reply-To header when the reply is to the site or a public topic. Use "username <>" for the Reply-To header only when the reply is to a private message topic.
This commit is contained in:
parent
72130357ed
commit
0af1242aa8
@ -215,6 +215,7 @@ class UserNotifications < ActionMailer::Base
|
||||
username: from_alias,
|
||||
add_unsubscribe_link: true,
|
||||
allow_reply_by_email: allow_reply_by_email,
|
||||
private_reply: post.topic.private_message?,
|
||||
include_respond_instructions: !user.suspended?,
|
||||
template: template,
|
||||
html_override: html,
|
||||
|
@ -136,6 +136,13 @@ module Email
|
||||
@opts[:allow_reply_by_email]
|
||||
end
|
||||
|
||||
def private_reply?
|
||||
SiteSetting.reply_by_email_enabled? &&
|
||||
reply_by_email_address.present? &&
|
||||
@opts[:allow_reply_by_email] &&
|
||||
@opts[:private_reply]
|
||||
end
|
||||
|
||||
def from_value
|
||||
return @from_value if @from_value
|
||||
@from_value = @opts[:from] || SiteSetting.notification_email
|
||||
@ -149,7 +156,11 @@ module Email
|
||||
|
||||
@reply_by_email_address = SiteSetting.reply_by_email_address.dup
|
||||
@reply_by_email_address.gsub!("%{reply_key}", reply_key)
|
||||
@reply_by_email_address = alias_email(@reply_by_email_address)
|
||||
@reply_by_email_address = if private_reply?
|
||||
alias_email(@reply_by_email_address)
|
||||
else
|
||||
site_alias_email(@reply_by_email_address)
|
||||
end
|
||||
|
||||
@reply_by_email_address
|
||||
end
|
||||
@ -159,6 +170,10 @@ module Email
|
||||
"#{@opts[:from_alias]} <#{source}>"
|
||||
end
|
||||
|
||||
def site_alias_email(source)
|
||||
return "#{SiteSetting.title} <#{source}>"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user