Class: Net::SMTP

Inherits:
Object
  • Object
show all
Defined in:
lib/smtp/patch/smtp.rb

Instance Method Summary collapse

Instance Method Details

#original_rcptto_listObject



20
# File 'lib/smtp/patch/smtp.rb', line 20

alias original_rcptto_list rcptto_list

#rcptto_list(to_addrs) ⇒ Object

Raises:

  • (ArgumentError)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/smtp/patch/smtp.rb', line 22

def rcptto_list(to_addrs)
  raise ArgumentError, 'mail destination not given' if to_addrs.empty?
  ok_users = []
  errors = {}
  to_addrs.flatten.each do |addr|
    begin
      rcptto addr
    rescue SMTPError
      errors[addr] = $!
    else
      ok_users << addr
    end
  end
  raise ArgumentError, 'mail destination not given' if ok_users.empty?
  ret = yield
  raise SMTPErrors, errors if errors.any?
  ret
end