-
Notifications
You must be signed in to change notification settings - Fork 52
Rescuing Net::STMPSyntaxError
Alex edited this page May 7, 2015
·
1 revision
We had a line in AccountObserver
to rescue SMTP errors.
begin
AccountNotifier.deliver_#_notification(account)
rescue Net::SMTPSyntaxError => e
if e.to_s.include?('Bad recipient address syntax')
account.errors.add(:email, "The Black Duck Open Hub could not send registration email to <strong class='red'>#{account.email}</strong>. Invalid Email Address provided.")
raise ActiveRecord::Rollback
end
end
This was introduced in ddb580fc1 to resolve a bug reported in OTWO-1544. We get an application error when user uses an email format like user...@gmail.com
. The ticket is still open and the current fix in Ohloh does not resolve the problem. So we are opting to not migrate this logic but instead introduce a validation for the offending format.