mirror of
https://github.com/discourse/discourse.git
synced 2025-03-24 08:35:44 +08:00
FIX: always update bounce_score even when email was not auto_generated
This commit is contained in:
parent
8d2c878b34
commit
6ed03bf3d9
@ -144,23 +144,17 @@ module Email
|
|||||||
|
|
||||||
@incoming_email.update_columns(is_bounce: true)
|
@incoming_email.update_columns(is_bounce: true)
|
||||||
|
|
||||||
if verp
|
if verp && (bounce_key = verp[/\+verp-(\h{32})@/, 1]) && (email_log = EmailLog.find_by(bounce_key: bounce_key))
|
||||||
bounce_key = verp[/\+verp-(\h{32})@/, 1]
|
email_log.update_columns(bounced: true)
|
||||||
if bounce_key && (email_log = EmailLog.find_by(bounce_key: bounce_key))
|
email = email_log.user.try(:email).presence
|
||||||
email_log.update_columns(bounced: true)
|
|
||||||
email = email_log.user.try(:email) || @from_email
|
|
||||||
if email.present? && @mail.error_status.present?
|
|
||||||
if @mail.error_status.start_with?("4.")
|
|
||||||
Email::Receiver.update_bounce_score(email, SOFT_BOUNCE_SCORE)
|
|
||||||
else @mail.error_status.start_with?("5.")
|
|
||||||
Email::Receiver.update_bounce_score(email, HARD_BOUNCE_SCORE)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_auto_generated?
|
email ||= @from_email
|
||||||
Email::Receiver.update_bounce_score(@from_email, SOFT_BOUNCE_SCORE)
|
|
||||||
|
if @mail.error_status.present? && @mail.error_status.start_with?("4.")
|
||||||
|
Email::Receiver.update_bounce_score(email, SOFT_BOUNCE_SCORE)
|
||||||
|
else
|
||||||
|
Email::Receiver.update_bounce_score(email, HARD_BOUNCE_SCORE)
|
||||||
end
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user