ruby-changes:15474
From: nobu <ko1@a...>
Date: Sat, 17 Apr 2010 08:58:03 +0900 (JST)
Subject: [ruby-changes:15474] Ruby:r27374 (ruby_1_8, trunk): * lib/net/smtp.rb (Net::SMTP#rcptto_list): continue when at least
nobu 2010-04-17 08:57:43 +0900 (Sat, 17 Apr 2010) New Revision: 27374 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27374 Log: * 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]. Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/lib/net/smtp.rb trunk/ChangeLog trunk/lib/net/smtp.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 27373) +++ ChangeLog (revision 27374) @@ -1,3 +1,9 @@ +Sat Apr 17 08:57:41 2010 Nobuyoshi Nakada <nobu@r...> + + * 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]. + Sat Apr 17 07:43:55 2010 Kazuhiro NISHIYAMA <zn@m...> * test/thread/test_queue.rb (TestQueue#grind): fix typos. Index: lib/net/smtp.rb =================================================================== --- lib/net/smtp.rb (revision 27373) +++ lib/net/smtp.rb (revision 27374) @@ -651,8 +651,7 @@ 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 @@ 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 @@ 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) Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 27373) +++ ruby_1_8/ChangeLog (revision 27374) @@ -1,3 +1,9 @@ +Sat Apr 17 08:57:41 2010 Nobuyoshi Nakada <nobu@r...> + + * 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]. + Sat Apr 17 08:35:14 2010 Nobuyoshi Nakada <nobu@r...> * Makefile.in, configure.in, common.mk, */Makefile.sub (CHDIR): cd Index: ruby_1_8/lib/net/smtp.rb =================================================================== --- ruby_1_8/lib/net/smtp.rb (revision 27373) +++ ruby_1_8/lib/net/smtp.rb (revision 27374) @@ -651,8 +651,7 @@ 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 @@ 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 @@ 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/