@@ -458,15 +458,15 @@ def debug_output=(arg)
458
458
459
459
#
460
460
# :call-seq:
461
- # 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| ... }
462
- # start(address, port = nil, helo = 'localhost', user = nil, secret = nil, authtype = nil) { |smtp| ... }
461
+ # 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| ... }
462
+ # start(address, port = nil, helo = 'localhost', username = nil, secret = nil, authtype = nil) { |smtp| ... }
463
463
#
464
464
# Creates a new Net::SMTP object and connects to the server.
465
465
#
466
466
# This method is equivalent to:
467
467
#
468
468
# Net::SMTP.new(address, port, tls_verify: flag, tls_hostname: hostname, ssl_context_params: nil)
469
- # .start(helo: helo_domain, user : account, secret: password, authtype: authtype)
469
+ # .start(helo: helo_domain, username : account, secret: password, authtype: authtype)
470
470
#
471
471
# See also: Net::SMTP.new, #start
472
472
#
@@ -513,7 +513,7 @@ def debug_output=(arg)
513
513
#
514
514
# +authtype+ is the SASL authentication mechanism.
515
515
#
516
- # +user+ is the authentication or authorization identity.
516
+ # +username+ or + user+ is the authentication or authorization identity.
517
517
#
518
518
# +secret+ or +password+ is your password or other authentication token.
519
519
#
@@ -537,15 +537,16 @@ def debug_output=(arg)
537
537
#
538
538
def SMTP . start ( address , port = nil , *args , helo : nil ,
539
539
user : nil , secret : nil , password : nil , authtype : nil ,
540
+ username : nil ,
540
541
tls : false , starttls : :auto ,
541
542
tls_verify : true , tls_hostname : nil , ssl_context_params : nil ,
542
543
&block )
543
544
raise ArgumentError , "wrong number of arguments (given #{ args . size + 2 } , expected 1..6)" if args . size > 4
544
545
helo ||= args [ 0 ] || 'localhost'
545
- user ||= args [ 1 ]
546
+ username ||= user || args [ 1 ]
546
547
secret ||= password || args [ 2 ]
547
548
authtype ||= args [ 3 ]
548
- 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 )
549
+ 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 )
549
550
end
550
551
551
552
# +true+ if the \SMTP session has been started.
@@ -555,8 +556,8 @@ def started?
555
556
556
557
#
557
558
# :call-seq:
558
- # start(helo: 'localhost', user : nil, secret: nil, authtype: nil) { |smtp| ... }
559
- # start(helo = 'localhost', user = nil, secret = nil, authtype = nil) { |smtp| ... }
559
+ # start(helo: 'localhost', username : nil, secret: nil, authtype: nil) { |smtp| ... }
560
+ # start(helo = 'localhost', username = nil, secret = nil, authtype = nil) { |smtp| ... }
560
561
#
561
562
# Opens a TCP connection and starts the SMTP session.
562
563
#
@@ -570,7 +571,7 @@ def started?
570
571
#
571
572
# +authtype+ is the SASL authentication mechanism.
572
573
#
573
- # +user+ is the authentication or authorization identity.
574
+ # +username+ or + user+ is the authentication or authorization identity.
574
575
#
575
576
# +secret+ or +password+ is your password or other authentication token.
576
577
#
@@ -594,7 +595,7 @@ def started?
594
595
#
595
596
# require 'net/smtp'
596
597
# smtp = Net::SMTP.new('smtp.mail.server', 25)
597
- # smtp.start(helo: helo_domain, user : account, secret: password, authtype: authtype) do |smtp|
598
+ # smtp.start(helo: helo_domain, username : account, secret: password, authtype: authtype) do |smtp|
598
599
# smtp.send_message msgstr, '[email protected] ', ['[email protected] ']
599
600
# end
600
601
#
@@ -618,10 +619,11 @@ def started?
618
619
# * Net::ReadTimeout
619
620
# * IOError
620
621
#
621
- def start ( *args , helo : nil , user : nil , secret : nil , password : nil , authtype : nil )
622
+ def start ( *args , helo : nil , user : nil , secret : nil , password : nil , authtype : nil ,
623
+ username : nil )
622
624
raise ArgumentError , "wrong number of arguments (given #{ args . size } , expected 0..4)" if args . size > 4
623
625
helo ||= args [ 0 ] || 'localhost'
624
- user ||= args [ 1 ]
626
+ username ||= user || args [ 1 ]
625
627
secret ||= password || args [ 2 ]
626
628
authtype ||= args [ 3 ]
627
629
if defined? ( OpenSSL ::VERSION )
@@ -638,13 +640,13 @@ def start(*args, helo: nil, user: nil, secret: nil, password: nil, authtype: nil
638
640
end
639
641
if block_given?
640
642
begin
641
- do_start helo , user , secret , authtype
643
+ do_start helo , username , secret , authtype
642
644
return yield ( self )
643
645
ensure
644
646
do_finish
645
647
end
646
648
else
647
- do_start helo , user , secret , authtype
649
+ do_start helo , username , secret , authtype
648
650
return self
649
651
end
650
652
end
0 commit comments