summaryrefslogtreecommitdiff
path: root/lib/net/smtp.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-13 07:29:15 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-13 07:29:15 +0000
commitec8a9bba354e3bcdb7b7b004d3ce3d148bd9fc7f (patch)
treec159d8a62f8328d5c3a962b13e8c2b96c64b316d /lib/net/smtp.rb
parent2e23ebc601fd5c8d7de232e470e2374df8888d11 (diff)
maillib-1.0.2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/smtp.rb')
-rw-r--r--lib/net/smtp.rb103
1 files changed, 97 insertions, 6 deletions
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 9f534c20c0..de97feaa23 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -1,12 +1,34 @@
-#
-# smtp.rb version 1.0.1
-#
-# author Minero Aoki <aamine@dp.u-netsurf.ne.jp>
-#
+=begin
+
+= Net module version 1.0.2 reference manual
+
+smtp.rb written by Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+This library is distributed under the terms of Ruby style license.
+You can freely redistribute/modify/copy this file.
+
+=end
+
require 'net/session'
+=begin
+
+== Net::SMTPSession
+
+=== Super Class
+
+Net::Session
+
+=== Class Methods
+
+: new( address = 'localhost', port = 25 )
+
+ This method create new SMTPSession object.
+
+=end
+
module Net
class SMTPSession < Session
@@ -16,6 +38,33 @@ module Net
@port = 25
end
+=begin
+
+=== Methods
+
+: start( helo_domain = ENV['HOSTNAME'] )
+
+ This method opens TCP connection and start SMTP session.
+ If session had been started, do nothing and return false.
+
+: sendmail( mailsrc, from_domain, to_addrs )
+
+ This method sends 'mailsrc' as mail. SMTPSession read strings from 'mailsrc'
+ by calling 'each' iterator, and convert them into "\r\n" terminated string when write.
+
+ SMTPSession's Exceptions are:
+ * Protocol::ProtoSyntaxError: syntax error (errno.500)
+ * Protocol::ProtoFatalError: fatal error (errno.550)
+ * Protocol::ProtoUnknownError: unknown error
+ * Protocol::ProtoServerBusy: temporary error (errno.420/450)
+
+: finish
+
+ This method closes SMTP session.
+ If session had not started, do nothind and return false.
+
+=end
+
def sendmail( mailsrc, fromaddr, toaddrs )
@proto.mailfrom( fromaddr )
@proto.rcpt( toaddrs )
@@ -43,6 +92,48 @@ module Net
SMTP = SMTPSession
+=begin
+
+== Net::SMTPCommand
+
+=== Super Class
+
+Net::Command
+
+=== Class Methods
+
+: new( socket )
+
+ This method creates new SMTPCommand object, and open SMTP session.
+
+
+=== Methods
+
+: helo( helo_domain )
+
+ This method send "HELO" command and start SMTP session.<br>
+ helo_domain is localhost's FQDN.
+
+: mailfrom( from_addr )
+
+ This method sends "MAIL FROM" command.<br>
+ from_addr is your mail address(????@????).
+
+: rcpt( to_addrs )
+
+ This method sends "RCPT TO" command.<br>
+ to_addrs is array of mail address(???@???) of destination.
+
+: data( mailsrc )
+
+ This method send 'mailsrc' as mail. SMTP reads strings from 'mailsrc'
+ by calling 'each' iterator.
+
+: quit
+
+ This method sends "QUIT" command and ends SMTP session.
+
+=end
class SMTPCommand < Command
@@ -121,7 +212,7 @@ module Net
end
- unless Session::Version == '1.0.1' then
+ unless Session::Version == '1.0.2' then
$stderr.puts "WARNING: wrong version of session.rb & smtp.rb"
end