From 773e35ced30fa2c03ddb2a332bf8a9aebb56aa44 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Tue, 23 Aug 2005 05:53:14 +0000 Subject: Compiled on Windows. Fixed a bunch of stuff. Almost ready to release. Implemented a nice dispatcher! Non-blocking check-links and forward server use the dispatcher. --- test/ftptest.lua | 4 ++-- test/testmesg.lua | 42 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/ftptest.lua b/test/ftptest.lua index ef1bf0f..63d20e6 100644 --- a/test/ftptest.lua +++ b/test/ftptest.lua @@ -12,8 +12,8 @@ local host, port, index_file, index, back, err, ret local t = socket.gettime() -host = host or "diego.student.princeton.edu" -index_file = "test/index.html" +host = host or "localhost" +index_file = "index.html" -- a function that returns a directory listing diff --git a/test/testmesg.lua b/test/testmesg.lua index 37e8c11..1dd9a97 100644 --- a/test/testmesg.lua +++ b/test/testmesg.lua @@ -3,6 +3,42 @@ local smtp = require("socket.smtp") local mime = require("mime") local ltn12 = require("ltn12") +function filter(s) + if s then io.write(s) end + return s +end + +source = smtp.message { + headers = { ['content-type'] = 'multipart/alternative' }, + body = { + [1] = { + headers = { ['content-type'] = 'text/html' }, + body = " Hi, there... " + }, + [2] = { + headers = { ['content-type'] = 'text/plain' }, + body = "Hi, there..." + } + } +} + +r, e = smtp.send{ + rcpt = {"", + "" }, + from = "", + source = ltn12.source.chain(source, filter), + --server = "mail.cs.princeton.edu" + server = "localhost", + port = 2525 +} + + +os.exit() + + + + + -- creates a source to send a message with two parts. The first part is -- plain text, the second part is a PNG image, encoded as base64. source = smtp.message{ @@ -48,10 +84,6 @@ source = smtp.message{ } } -function filter(s) - if s then io.write(s) end - return s -end r, e = smtp.send{ rcpt = {"", @@ -64,3 +96,5 @@ r, e = smtp.send{ } print(r, e) + + -- cgit v1.2.3-55-g6feb