mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
a350d0afc5
commit
2939d61f28
2 changed files with 23 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Sat Apr 17 08:57:41 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@mbf.nifty.com>
|
Sat Apr 17 07:43:55 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||||
|
|
||||||
* test/thread/test_queue.rb (TestQueue#grind): fix typos.
|
* test/thread/test_queue.rb (TestQueue#grind): fix typos.
|
||||||
|
|
|
@ -651,8 +651,7 @@ module Net
|
||||||
def send_message(msgstr, from_addr, *to_addrs)
|
def send_message(msgstr, from_addr, *to_addrs)
|
||||||
raise IOError, 'closed session' unless @socket
|
raise IOError, 'closed session' unless @socket
|
||||||
mailfrom from_addr
|
mailfrom from_addr
|
||||||
rcptto_list to_addrs
|
rcptto_list(to_addrs) {data msgstr}
|
||||||
data msgstr
|
|
||||||
end
|
end
|
||||||
|
|
||||||
alias send_mail send_message
|
alias send_mail send_message
|
||||||
|
@ -705,8 +704,7 @@ module Net
|
||||||
def open_message_stream(from_addr, *to_addrs, &block) # :yield: stream
|
def open_message_stream(from_addr, *to_addrs, &block) # :yield: stream
|
||||||
raise IOError, 'closed session' unless @socket
|
raise IOError, 'closed session' unless @socket
|
||||||
mailfrom from_addr
|
mailfrom from_addr
|
||||||
rcptto_list to_addrs
|
rcptto_list(to_addrs) {data(&block)}
|
||||||
data(&block)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
alias ready open_message_stream # obsolete
|
alias ready open_message_stream # obsolete
|
||||||
|
@ -830,10 +828,24 @@ module Net
|
||||||
|
|
||||||
def rcptto_list(to_addrs)
|
def rcptto_list(to_addrs)
|
||||||
raise ArgumentError, 'mail destination not given' if to_addrs.empty?
|
raise ArgumentError, 'mail destination not given' if to_addrs.empty?
|
||||||
|
ok_users = []
|
||||||
|
unknown_users = []
|
||||||
to_addrs.flatten.each do |addr|
|
to_addrs.flatten.each do |addr|
|
||||||
|
begin
|
||||||
rcptto addr
|
rcptto addr
|
||||||
|
rescue SMTPAuthenticationError
|
||||||
|
unknown_users << addr.dump
|
||||||
|
else
|
||||||
|
ok_users << addr
|
||||||
end
|
end
|
||||||
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)
|
def rcptto(to_addr)
|
||||||
if $SAFE > 0
|
if $SAFE > 0
|
||||||
|
|
Loading…
Reference in a new issue