aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-03-19 06:14:56 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-03-19 06:14:56 +0000
commit2a14ac4fe4bb4dd6d7a7ec5195c15a4e3f783ad5 (patch)
tree7026acecc263950e57fa73e5815889977f916eae /test
parente896454e6c7fb574f405729e1ce94c223578e078 (diff)
downloadluasocket-2a14ac4fe4bb4dd6d7a7ec5195c15a4e3f783ad5.tar.gz
luasocket-2a14ac4fe4bb4dd6d7a7ec5195c15a4e3f783ad5.tar.bz2
luasocket-2a14ac4fe4bb4dd6d7a7ec5195c15a4e3f783ad5.zip
Adjusted some fine details.
Diffstat (limited to 'test')
-rw-r--r--test/testmesg.lua53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/testmesg.lua b/test/testmesg.lua
new file mode 100644
index 0000000..228bbe4
--- /dev/null
+++ b/test/testmesg.lua
@@ -0,0 +1,53 @@
1mesgt = {
2 headers = {
3 to = "D Burgess <db@werx4.com>",
4 subject = "Looking good! (please check headers)"
5 },
6 body = {
7 preamble = "Some attatched stuff",
8 [1] = {
9 body = "Testing stuffing.\r\n.\r\nGot you.\r\n.Hehehe.\r\n"
10 },
11 [2] = {
12 headers = {
13 ["content-type"] = 'application/octet-stream; name="luasocket"',
14 ["content-disposition"] = 'attachment; filename="luasocket"',
15 ["content-transfer-encoding"] = "BASE64"
16 },
17 body = ltn12.source.chain(
18 ltn12.source.file(io.open("luasocket", "rb")),
19 ltn12.filter.chain(
20 mime.encode("base64"),
21 mime.wrap()
22 )
23 )
24 },
25 [3] = {
26 headers = {
27 ["content-type"] = 'text/plain; name="testmesg.lua"',
28 ["content-disposition"] = 'attachment; filename="testmesg.lua"',
29 ["content-transfer-encoding"] = "QUOTED-PRINTABLE"
30 },
31 body = ltn12.source.chain(
32 ltn12.source.file(io.open("message.lua", "rb")),
33 ltn12.filter.chain(
34 mime.normalize(),
35 mime.encode("quoted-printable"),
36 mime.wrap("quoted-printable")
37 )
38 )
39 },
40 epilogue = "Done attaching stuff",
41 }
42}
43
44-- sink = ltn12.sink.file(io.stdout)
45-- source = ltn12.source.chain(socket.smtp.message(mesgt), socket.smtp.stuff())
46-- ltn12.pump(source, sink)
47
48print(socket.smtp.send {
49 rcpt = {"<db@werx4.com>", "<diego@cs.princeton.edu>"},
50 from = "<diego@cs.princeton.edu>",
51 source = socket.smtp.message(mesgt),
52 server = "smtp.princeton.edu"
53})