diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-16 01:02:07 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-16 01:02:07 +0000 |
| commit | d46f7a09a768b146f2f3cdc9a6a50357832bd1c7 (patch) | |
| tree | d4f7ca1e677d06446245691d5ece6dab51915f16 /src/smtp.lua | |
| parent | 843a431ef98fd541d98fd3898463985d9bfcde28 (diff) | |
| download | luasocket-d46f7a09a768b146f2f3cdc9a6a50357832bd1c7.tar.gz luasocket-d46f7a09a768b146f2f3cdc9a6a50357832bd1c7.tar.bz2 luasocket-d46f7a09a768b146f2f3cdc9a6a50357832bd1c7.zip | |
Fixed smtp.lua loading.
Adjusted tftp module.
Added some comments.
Diffstat (limited to 'src/smtp.lua')
| -rw-r--r-- | src/smtp.lua | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/smtp.lua b/src/smtp.lua index dc80c35..fb76ea4 100644 --- a/src/smtp.lua +++ b/src/smtp.lua | |||
| @@ -2,14 +2,13 @@ | |||
| 2 | -- SMTP client support for the Lua language. | 2 | -- SMTP client support for the Lua language. |
| 3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
| 4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
| 5 | -- Conforming to RFC 2821 | ||
| 6 | -- RCS ID: $Id$ | 5 | -- RCS ID: $Id$ |
| 7 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
| 8 | 7 | ||
| 9 | ----------------------------------------------------------------------------- | 8 | ----------------------------------------------------------------------------- |
| 10 | -- Load required modules | 9 | -- Load required modules |
| 11 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
| 12 | local smtp = requirelib("smtp") | 11 | local smtp = requirelib("smtp", "luaopen_smtp", getfenv(1)) |
| 13 | local socket = require("socket") | 12 | local socket = require("socket") |
| 14 | local ltn12 = require("ltn12") | 13 | local ltn12 = require("ltn12") |
| 15 | local tp = require("tp") | 14 | local tp = require("tp") |
| @@ -206,6 +205,7 @@ end | |||
| 206 | --------------------------------------------------------------------------- | 205 | --------------------------------------------------------------------------- |
| 207 | -- High level SMTP API | 206 | -- High level SMTP API |
| 208 | ----------------------------------------------------------------------------- | 207 | ----------------------------------------------------------------------------- |
| 208 | socket.protect = function(a) return a end | ||
| 209 | send = socket.protect(function(mailt) | 209 | send = socket.protect(function(mailt) |
| 210 | local con = open(mailt.server, mailt.port) | 210 | local con = open(mailt.server, mailt.port) |
| 211 | con:greet(mailt.domain) | 211 | con:greet(mailt.domain) |
| @@ -213,5 +213,3 @@ send = socket.protect(function(mailt) | |||
| 213 | con:quit() | 213 | con:quit() |
| 214 | return con:close() | 214 | return con:close() |
| 215 | end) | 215 | end) |
| 216 | |||
| 217 | return smtp | ||
