File: email.html

package info (click to toggle)
lua-logging 1.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 240 kB
  • ctags: 50
  • sloc: makefile: 20
file content (154 lines) | stat: -rw-r--r-- 4,713 bytes parent folder | download | duplicates (2)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>LuaLogging: A simple API to use logging features in Lua</title>
    <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
	
<div id="container">

<div id="product">
	<div id="product_logo"><a href="http://www.keplerproject.org">
		<img alt="LuaLogging logo" src="lualogging-128.png"/>
	</a></div>
	<div id="product_name"><big><b>LuaLogging</b></big></div>
	<div id="product_description">A simple API to use logging features in Lua</div>
</div> <!-- id="product" -->

<div id="main">
	
<div id="navigation">
<h1>LuaLogging</h1>
	<ul>
		<li><a href="index.html">Home</a>
			<ul>
				<li><a href="index.html#overview">Overview</a></li>
				<li><a href="index.html#status">Status</a></li>
				<li><a href="index.html#download">Download</a></li>
                <li><a href="index.html#dependencies">Dependencies</a></li>
				<li><a href="index.html#history">History</a></li>
				<li><a href="index.html#credits">Credits</a></li>
				<li><a href="index.html#contact">Contact</a></li>
			</ul>
		</li>
		<li><a href="manual.html">Manual</a>
			<ul>
				<li><a href="manual.html#introduction">Introduction</a></li>
				<li><a href="manual.html#installation">Installation</a></li>
				<li><a href="manual.html#logger">Logger objects</a></li>
				<li><a href="manual.html#examples">Examples</a></li>
			</ul>
		</li>
		<li><a href="manual.html#appenders">Appenders</a>
			<ul>
				<li><a href="console.html">Console</a></li>
				<li><a href="file.html">File</a></li>
				<li><a href="sql.html">SQL</a></li>
				<li><a href="socket.html">Socket</a></li>
				<li><strong>Email</strong></li>
			</ul>
		</li>
        <li><a href="http://luaforge.net/projects/lualogging/">Project</a>
            <ul>
                <li><a href="http://luaforge.net/tracker/?group_id=51">Bug Tracker</a></li>
                <li><a href="http://luaforge.net/scm/?group_id=51">CVS</a></li>
            </ul>
        </li>
		<li><a href="license.html">License</a></li>
	</ul>
</div> <!-- id="navigation" -->

<div id="content">

<h2>Email appender</h2>

<p>This appender can be used to send log requests through email. One email
message is sent for each log request.</p>

<pre class="example">
function logging.email {
    from = <i>string</i>,
    rcpt = <i>string</i> or <i>string-table</i>,
    [user = <i>string</i>,]
    [password = <i>string</i>,]
    [server = <i>string</i>,]
    [port = <i>number</i>,]
    [domain = <i>string</i>,]
    [headers = <i>table</i>,]
    [logPattern = <i>string</i>,]
}
</pre>

<ul>
    <li><code>from</code>:<br />
    The sender of the email message.</li>
    
    <li><code>rcpt</code>:<br />
    The recipient of the email message. A string or a numerically indexed Lua table with strings.</li>
    
    <li><code>user</code>:<br />
    User for authentication.</li>
    
    <li><code>password</code>:<br />
    Password for authentication.</li>
    
    <li><code>server</code>:<br />
    Server to connect to. Default is <code>"localhost"</code>.</li>
    
    <li><code>port</code>:<br />
    Port to connect to. Default is <code>25</code>.</li>
    
    <li><code>domain</code>:<br />
    Domain name used to greet the server. Defaults to the local
    machine host name.</li>
    
    <li><code>headers.to</code>:<br />
    The recipient of the message, as an extended description.</li>
    
    <li><code>headers.from</code>:<br />
    The sender of the message, as an extended description.</li>
    
    <li><code>headers.subject</code>:<br />
    The subject of the message sent. This can contain patterns like
    the <code>logPattern</code> parameter.</li>
    
    <li><code>logPattern</code>:<br />
    A pattern can be specified to control how the message is
    written.<br />
    The default value is <code>"%date %level %message\n"</code>.</li>
</ul>

<h2>Example</h2>

<pre class="example">
require"logging.email"

local logger = logging.email {
  rcpt = "mail@host.com",
  from = "mail@host.com",
  headers = { 
    subject = "[%level] logging.email test", 
  },
}

logger:info("logging.sql test")
logger:debug("debugging...")
logger:error("error!")
</pre>

</div> <!-- id="content" -->

</div> <!-- id="main" -->

<div id="about">
	<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
	<p><small>$Id: email.html,v 1.11 2007/10/30 19:57:59 carregal Exp $</small></p>
</div> <!-- id="about" -->

</div> <!-- id="container" -->

</body>
</html>