forked from moteus/lua-sendmail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendmail.ldoc
126 lines (110 loc) · 4.54 KB
/
sendmail.ldoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
-- @module sendmail
--
--- Default charset
DEFAULT_CHARSET = 'windows-1251'
--- Default encoding
DEFAULT_ENCODE = 'base64'
--- a table describe FROM header.
-- @tfield ?string title title used in header (or first value of table)
-- @tfield string address email address
-- @tfield ?string charset title charset
-- @tfield ?string encode ecoding used for title
-- @table FROM
--- a table describe TO headers.
-- @tfield ?string title title used in header (or first value of table)
-- @tfield string|{string,...} address email address
-- @tfield ?string charset title charset
-- @tfield ?string encode ecoding used for title
-- @table TO
--- a table describe smtp server.
-- @tfield string address
-- @tfield number|string port (default 25 and 465 if you set `ssl` options)
-- @tfield string user
-- @tfield string password
-- @tfield SSL|boolean|string|opaque ssl securety options. `true` mean use default options. Also you can pass protocol name as string. (required `LuaSec` module).
-- opaque value used with custom `create` function.
-- @tfield function create constructor for creating socket. If `ssl` option is provided then it pass to `create` function without any changes.
-- @table SERVER
--- a table describe SSL securety options.
-- For more information see documentation for `LuaSec` module.
-- </br>Library use similar mechanism to find CA file as in cURL library.
-- </br>Library use environment variables to find CA file.
-- </br>On Windows library also search in system directory. (required `lua-path` module)
-- </br>For more information see <a href=http://curl.haxx.se/docs/sslcerts.html>SSL Certificate Verification</a>
-- for cURL library.
--
-- @tfield ?string|table protocol (default "tlsv1")
-- @tfield ?string|table verify (default {"peer", "fail_if_no_peer_cert"})
-- @tfield ?string|table options (default {"all"})
-- @tfield ?string cafile
-- @tfield ?string capath
-- @table SSL
-- @usage
-- ssl = {verify = "none"} -- ignore sert
--- a table describe message.
-- @tfield string|SUBJECT subject (or first value of table)
-- @tfield ?string|TEXT text if no mime_type then 'text/plain' used (or second value of table)
-- @tfield ?string|TEXT html if no mime_type then 'text/html' used
-- @tfield ?string|FILE|{FILE,...} file path, file or array of files
-- @table MESSAGE
-- @usage
--msg = {'this is subject'}
--msg = {'this is subject';'this is text'}
--msg = {subject = 'this is subject';'this is text'}
--msg = {'this is subject';text='this is text'}
--msg = {'subject', 'text', file = 'path/to/file'}
--- a table describe subject.
-- @tfield string title subject's title (or first value of table)
-- @tfield ?string charset title charset
-- @tfield ?string encode ecoding used for title
-- @table SUBJECT
--- a table describe text part in message.
-- @tfield string data text data of message (or first value of table)
-- @tfield string mime_type
-- @tfield ?string charset
-- @tfield ?string encode
-- @tfield table headers
-- @table TEXT
--- a table describe attached file in message.
-- One of fields path, data, file are required.
-- If no name and path is setted then name sets to basename of file.
-- @tfield string name attachment's name
-- @tfield ?string path surce file path
-- @tfield ?string data content of attachment
-- @tfield ?file file opened file handle (io.open in binary mode)
-- @tfield ?ltn12.source source source of file content
-- @tfield ?string charset
-- @tfield ?string encode
-- @tfield ?string mime_type Default 'application/octet-stream'
-- @tfield ?string disposition Default 'attachment'
-- @tfield ?table headers
-- @table FILE
--- a table describe sendmail options.
-- @tfield boolean confirm_sending
-- @table OPTIONS
--- Send mail params as single table.
-- @tfield string|FROM from
-- @tfield string|TO to
-- @tfield string|SERVER server
-- @tfield string|MESSAGE message
-- @tfield ?OPTIONS options
-- @table SENDPARAMS
--- Send mail.
-- @tparam string|FROM from
-- @tparam string|TO to
-- @tparam string|SERVER smtp_server
-- @tparam string|MESSAGE message
-- @tparam ?OPTIONS options
-- @treturn int|nil number of the sent messages
-- @treturn string error message
-- @usage
-- sendmail('me@host', 'to@host', 'host', {'test', 'hello'})
function sendmail(from, to, smtp_server, message, options)end
--- Send mail.
-- @tparam SENDPARAMS params
-- @treturn int|nil number of the sent messages
-- @treturn string error message
-- @usage
-- sendmail('me@host', 'to@host', 'host', {'test', 'hello'})
function sendmail(params)end