зеркало из https://github.com/github/ruby.git
* 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:
Родитель
a350d0afc5
Коммит
2939d61f28
|
@ -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>
|
||||
|
||||
* test/thread/test_queue.rb (TestQueue#grind): fix typos.
|
||||
|
|
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче