mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
use 'reply_by_email_address' setting for handling bounce emails using VERP
This commit is contained in:
@@ -116,16 +116,13 @@ module Email
|
||||
@message.header['List-Post'] = "<mailto:#{email}>"
|
||||
end
|
||||
|
||||
unless SiteSetting.bounce_email.blank?
|
||||
if SiteSetting.reply_by_email_address.present? && SiteSetting.reply_by_email_address["+"]
|
||||
email_log.bounce_key = SecureRandom.hex
|
||||
address,domain = SiteSetting.bounce_email.split('@')
|
||||
address << (address =~ /[+]/ ? "-" : '+')
|
||||
address << email_log.bounce_key
|
||||
|
||||
# WARNING: RFC claims you can not set the Return Path header, this is 100% correct
|
||||
# however Rails has special handling for this header and ends up using this value
|
||||
# as the Envelope From address so stuff works as expected
|
||||
@message.header[:return_path] = "#{address}@#{domain}"
|
||||
@message.header[:return_path] = SiteSetting.reply_by_email_address.sub("%{reply_key}", "verp-#{email_log.bounce_key}")
|
||||
end
|
||||
|
||||
email_log.post_id = post_id if post_id.present?
|
||||
|
||||
Reference in New Issue
Block a user