diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index 790d9da..fcdc2bb 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -458,15 +458,15 @@ def debug_output=(arg) # # :call-seq: - # start(address, port = nil, helo: 'localhost', user: nil, secret: nil, authtype: nil, tls: false, starttls: :auto, tls_verify: true, tls_hostname: nil, ssl_context_params: nil) { |smtp| ... } - # start(address, port = nil, helo = 'localhost', user = nil, secret = nil, authtype = nil) { |smtp| ... } + # start(address, port = nil, helo: 'localhost', username: nil, secret: nil, authtype: nil, tls: false, starttls: :auto, tls_verify: true, tls_hostname: nil, ssl_context_params: nil) { |smtp| ... } + # start(address, port = nil, helo = 'localhost', username = nil, secret = nil, authtype = nil) { |smtp| ... } # # Creates a new Net::SMTP object and connects to the server. # # This method is equivalent to: # # Net::SMTP.new(address, port, tls_verify: flag, tls_hostname: hostname, ssl_context_params: nil) - # .start(helo: helo_domain, user: account, secret: password, authtype: authtype) + # .start(helo: helo_domain, username: account, secret: password, authtype: authtype) # # See also: Net::SMTP.new, #start # @@ -513,7 +513,7 @@ def debug_output=(arg) # # +authtype+ is the SASL authentication mechanism. # - # +user+ is the authentication or authorization identity. + # +username+ or +user+ is the authentication or authorization identity. # # +secret+ or +password+ is your password or other authentication token. # @@ -537,15 +537,16 @@ def debug_output=(arg) # def SMTP.start(address, port = nil, *args, helo: nil, user: nil, secret: nil, password: nil, authtype: nil, + username: nil, tls: false, starttls: :auto, tls_verify: true, tls_hostname: nil, ssl_context_params: nil, &block) raise ArgumentError, "wrong number of arguments (given #{args.size + 2}, expected 1..6)" if args.size > 4 helo ||= args[0] || 'localhost' - user ||= args[1] + username ||= user || args[1] secret ||= password || args[2] authtype ||= args[3] - new(address, port, tls: tls, starttls: starttls, tls_verify: tls_verify, tls_hostname: tls_hostname, ssl_context_params: ssl_context_params).start(helo: helo, user: user, secret: secret, authtype: authtype, &block) + new(address, port, tls: tls, starttls: starttls, tls_verify: tls_verify, tls_hostname: tls_hostname, ssl_context_params: ssl_context_params).start(helo: helo, username: username, secret: secret, authtype: authtype, &block) end # +true+ if the \SMTP session has been started. @@ -555,8 +556,8 @@ def started? # # :call-seq: - # start(helo: 'localhost', user: nil, secret: nil, authtype: nil) { |smtp| ... } - # start(helo = 'localhost', user = nil, secret = nil, authtype = nil) { |smtp| ... } + # start(helo: 'localhost', username: nil, secret: nil, authtype: nil) { |smtp| ... } + # start(helo = 'localhost', username = nil, secret = nil, authtype = nil) { |smtp| ... } # # Opens a TCP connection and starts the SMTP session. # @@ -570,7 +571,7 @@ def started? # # +authtype+ is the SASL authentication mechanism. # - # +user+ is the authentication or authorization identity. + # +username+ or +user+ is the authentication or authorization identity. # # +secret+ or +password+ is your password or other authentication token. # @@ -594,7 +595,7 @@ def started? # # require 'net/smtp' # smtp = Net::SMTP.new('smtp.mail.server', 25) - # smtp.start(helo: helo_domain, user: account, secret: password, authtype: authtype) do |smtp| + # smtp.start(helo: helo_domain, username: account, secret: password, authtype: authtype) do |smtp| # smtp.send_message msgstr, 'from@example.com', ['dest@example.com'] # end # @@ -618,10 +619,11 @@ def started? # * Net::ReadTimeout # * IOError # - def start(*args, helo: nil, user: nil, secret: nil, password: nil, authtype: nil) + def start(*args, helo: nil, user: nil, secret: nil, password: nil, authtype: nil, + username: nil) raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 0..4)" if args.size > 4 helo ||= args[0] || 'localhost' - user ||= args[1] + username ||= user || args[1] secret ||= password || args[2] authtype ||= args[3] if defined?(OpenSSL::VERSION) @@ -638,13 +640,13 @@ def start(*args, helo: nil, user: nil, secret: nil, password: nil, authtype: nil end if block_given? begin - do_start helo, user, secret, authtype + do_start helo, username, secret, authtype return yield(self) ensure do_finish end else - do_start helo, user, secret, authtype + do_start helo, username, secret, authtype return self end end