mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
FIX: Prioritize VERP key over final_recipient header in bounced email
Per RFC3464 2.3.2, the final_recipient header may not match the address we originally sent the email to.
This commit is contained in:
@ -513,13 +513,13 @@ module Email
|
||||
def parse_from_field(mail = nil)
|
||||
mail ||= @mail
|
||||
|
||||
if mail.bounced?
|
||||
if email_log.present?
|
||||
email = email_log.to_address || email_log.user&.email
|
||||
return [email, email_log.user&.username]
|
||||
elsif mail.bounced?
|
||||
Array.wrap(mail.final_recipient).each do |from|
|
||||
return extract_from_address_and_name(from)
|
||||
end
|
||||
elsif email_log.present?
|
||||
email = email_log.user&.email || email_log.to_address
|
||||
return [email, email_log.user&.username]
|
||||
end
|
||||
|
||||
return unless mail[:from]
|
||||
|
Reference in New Issue
Block a user