From f4270f66e97cb5d9964366b60860154b3188b631 Mon Sep 17 00:00:00 2001 From: TOMITA Masahiro Date: Sat, 12 Aug 2023 16:53:54 +0900 Subject: [PATCH] Fixed issue sending emails to unaffected recipients on 53x error When multiple recipients were specified and one recipient encountered a 53x error, despite an exception being raised, emails were being sent to the recipients that didn't encounter errors. This patch has been applied to handle 53x errors the same way as other errors. --- lib/net/smtp.rb | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index 388c7f7..c998252 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -906,23 +906,10 @@ def mailfrom(from_addr, require_smtputf8 = false) def rcptto_list(to_addrs) raise ArgumentError, 'mail destination not given' if to_addrs.empty? - ok_users = [] - unknown_users = [] to_addrs.flatten.each do |addr| - begin - rcptto addr - rescue SMTPAuthenticationError - unknown_users << addr.to_s.dump - else - ok_users << addr - end - end - raise ArgumentError, 'mail destination not given' if ok_users.empty? - ret = yield - unless unknown_users.empty? - raise SMTPAuthenticationError, "failed to deliver for #{unknown_users.join(', ')}" + rcptto addr end - ret + yield end # +to_addr+ is +String+ or +Net::SMTP::Address+