summaryrefslogtreecommitdiff
path: root/lib/net/smtp.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-26 08:48:15 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-26 08:48:15 +0000
commitd8d148d81653d7be02ee2d4237b5e75856e02ee3 (patch)
treefb8b3458ccde7a9923c0ab9b33ef77f1bdf0f899 /lib/net/smtp.rb
parent688169fd83b24564b653c03977c168cea50ccd35 (diff)
o protocol.rb: version 1.1.9
o smtp.rb: arguments discription of do_ready was wrongly void git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/smtp.rb')
-rw-r--r--lib/net/smtp.rb61
1 files changed, 12 insertions, 49 deletions
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 2c387db..b2ac287 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -74,15 +74,14 @@ Net::Protocol
protocol_param :command_type, '::Net::SMTPCommand'
- def sendmail( mailsrc, fromaddr, toaddrs, &block )
- @command.mailfrom fromaddr
- @command.rcpt toaddrs
- @command.data
- @command.write_mail( mailsrc, &block )
+ def sendmail( mailsrc, fromaddr, toaddrs )
+ do_ready fromaddr, toaddrs
+ @command.write_mail mailsrc
end
def ready( fromaddr, toaddrs, &block )
- sendmail nil, fromaddr, toaddrs, &block
+ do_ready fromaddr, toaddrs
+ @command.write_mail( &block )
end
@@ -92,6 +91,12 @@ Net::Protocol
private
+ def do_ready( fromaddr, toaddrs )
+ @command.mailfrom fromaddr
+ @command.rcpt toaddrs
+ @command.data
+ end
+
def do_start( helodom = ENV['HOSTNAME'] )
unless helodom then
raise ArgumentError, "cannot get hostname"
@@ -111,48 +116,6 @@ Net::Protocol
SMTPSession = SMTP
-=begin
-
-== Net::SMTPCommand
-
-=== Super Class
-
-Net::Command
-
-=== Class Methods
-
-: new( socket )
- This method creates new SMTPCommand object, and open SMTP.
-
-
-=== Methods
-
-: helo( helo_domain )
- This method send "HELO" command and start SMTP.
- helo_domain is localhost's FQDN.
-
-: mailfrom( from_addr )
- This method sends "MAIL FROM" command.
- from_addr is your mail address (xxxx@xxxx)
-
-: rcpt( to_addrs )
- This method sends "RCPT TO" command.
- to_addrs is array of mail address (xxxx@xxxx) of destination.
-
-: data
- This method sends "DATA" command.
-
-: write_mail( mailsrc )
-: write_mail {|socket| ... }
- send 'mailsrc' as mail.
- SMTPCommand reads strings from 'mailsrc' by calling 'each' iterator.
- When iterator, SMTPCommand only stand by socket and pass it.
- (The socket will accepts only 'in_write' method in the block)
-
-: quit
- This method sends "QUIT" command and ends SMTP session.
-
-=end
class SMTPCommand < Command
@@ -189,7 +152,7 @@ Net::Command
end
- def write_mail( mailsrc, &block )
+ def write_mail( mailsrc = nil, &block )
@socket.write_pendstr mailsrc, &block
check_reply SuccessCode
end