summaryrefslogtreecommitdiff
path: root/lib/net/smtp.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-16 23:57:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-16 23:57:43 +0000
commit2939d61f285455c7b98de2a02df32cd34d068e01 (patch)
tree3da1507279d5ae5b95997264f91018b410da347a /lib/net/smtp.rb
parenta350d0afc5c2abcd9850e9f911a856c51f15e76f (diff)
* lib/net/smtp.rb (Net::SMTP#rcptto_list): continue when at least
one RCPT is accepted. based on a patch from Kero van Gelder at [ruby-core:26190]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/smtp.rb')
-rw-r--r--lib/net/smtp.rb22
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 871a4fb8e7..c96caae3d8 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -651,8 +651,7 @@ module Net
def send_message(msgstr, from_addr, *to_addrs)
raise IOError, 'closed session' unless @socket
mailfrom from_addr
- rcptto_list to_addrs
- data msgstr
+ rcptto_list(to_addrs) {data msgstr}
end
alias send_mail send_message
@@ -705,8 +704,7 @@ module Net
def open_message_stream(from_addr, *to_addrs, &block) # :yield: stream
raise IOError, 'closed session' unless @socket
mailfrom from_addr
- rcptto_list to_addrs
- data(&block)
+ rcptto_list(to_addrs) {data(&block)}
end
alias ready open_message_stream # obsolete
@@ -830,9 +828,23 @@ module Net
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|
- rcptto addr
+ begin
+ rcptto addr
+ rescue SMTPAuthenticationError
+ unknown_users << addr.dump
+ else
+ ok_users << addr
+ end
+ end
+ raise ArgumentError, 'mail destination not given' if ok_addrs.empty?
+ ret = yield
+ unless unknown_users.empty?
+ raise SMTPAuthenticationError, "failed to deliver for #{unknown_users.join(', ')}"
end
+ ret
end
def rcptto(to_addr)