From 0b1e93285ec4dafefb8277425e1ff58e5247715c Mon Sep 17 00:00:00 2001 From: shyouhei Date: Tue, 8 Jun 2010 06:14:59 +0000 Subject: merge revision(s) 27374,27512: * 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]. * lib/net/smtp.rb (Net::SMTP#rcptto_list): fixed typo. [ruby-core:29809] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@28208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ lib/net/smtp.rb | 22 +++++++++++++++++----- version.h | 2 +- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85fc4198b2..a360e46e25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Tue Jun 8 15:15:18 2010 Nobuyoshi Nakada + + * lib/net/smtp.rb (Net::SMTP#rcptto_list): fixed typo. + [ruby-core:29809] + +Tue Jun 8 15:15:18 2010 Nobuyoshi Nakada + + * 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]. + Tue Jun 8 15:14:11 2010 Nobuyoshi Nakada * LEGAL: separated the section for parse.c. contributed by Paul diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index 7c9d9388ef..46cba7704f 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_users.empty? + ret = yield + unless unknown_users.empty? + raise SMTPAuthenticationError, "failed to deliver for #{unknown_users.join(', ')}" end + ret end def rcptto(to_addr) diff --git a/version.h b/version.h index 7d95ecb479..c0d9f70ea4 100644 --- a/version.h +++ b/version.h @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2010-06-08" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20100608 -#define RUBY_PATCHLEVEL 272 +#define RUBY_PATCHLEVEL 273 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 -- cgit v1.2.3