Skip to content

Commit

Permalink
Merge pull request #56 from ruby/fixes/rcptto_53x_error
Browse files Browse the repository at this point in the history
Fixed issue sending emails to unaffected recipients on 53x error
  • Loading branch information
tmtm authored Aug 13, 2023
2 parents 90f897a + f4270f6 commit 2e5ac66
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions lib/net/smtp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand Down

0 comments on commit 2e5ac66

Please sign in to comment.