Non far crashare il reset password se SMTP rifiuta il destinatario.
Un account di test su dominio .test faceva 500; ora l'invio fallito viene loggato e l'API resta ok. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
require "net/smtp"
|
||||
require "openssl"
|
||||
|
||||
module MatchLiveTv
|
||||
class << self
|
||||
def jwt_secret
|
||||
@@ -102,6 +105,7 @@ module MatchLiveTv
|
||||
end
|
||||
|
||||
# In produzione senza SMTP non blocca il flusso (es. collaudo): la mail si può inviare a mano.
|
||||
# Errori SMTP (dominio invalido, EOF Aruba, porta chiusa) non devono far crashare la request.
|
||||
def deliver_mail(mail)
|
||||
if Rails.env.production? && !smtp_configured?
|
||||
Rails.logger.info("[mail] skip (SMTP assente): #{mail.subject}")
|
||||
@@ -110,6 +114,9 @@ module MatchLiveTv
|
||||
|
||||
mail.deliver_now
|
||||
true
|
||||
rescue EOFError, Net::SMTPError, Errno::ECONNREFUSED, Errno::ETIMEDOUT, SocketError, OpenSSL::SSL::SSLError => e
|
||||
Rails.logger.warn("[mail] delivery failed: #{mail.subject} #{e.class}: #{e.message}")
|
||||
false
|
||||
end
|
||||
|
||||
def privacy_controller_name
|
||||
|
||||
Reference in New Issue
Block a user