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
|
<html>
<body>
<h2><a href="mailfront.html">mailfront</a></h2>
<h1>Plugin: lua</h1>
<hr />
<p>This plugin allows for extending mailfront
using <a href="http://www.lua.org/">Lua</a>. All actions in
the <a href="plugin-api.html">mailfront plugin API</a> are exposed
through calls to functions of the same name in the script, with the
exception of the "<tt>init</tt>" function. For this function, the
return from the script itself is used. The functions are passed the
same parameters as described in the API. The return value from these
functions is a numeric SMTP response code followed by a message. If
the number is zero or <tt>nil</tt>, it is treated as an NULL response.
If the message is missing, the script wrapper provides a simple one
based on the response code.</p>
<h2>Configuration</h2>
<dl>
<dt><tt>$LUA_SCRIPT</tt></dt> <dd>The file name of the Lua script to
load. If not set, this plugin does nothing.</dd>
</dl>
<h2>Library</h2>
<p>The plugin registers some mailfront functions for script use:</p>
<dl>
<dt><tt>getenv(...)</tt></dt>
<dd>Returns the (string) value of each of the named session environment
variables.</dd>
<dt><tt>getnum(name, default)</tt></dt>
<dd>Returns the named session number, or <tt>default</tt> if it is not set.</dd>
<dt><tt>getstr(...)</tt></dt>
<dd>Returns the (string) value of each of the named session strings.</dd>
<dt><tt>msg(...)</tt></dt>
<dd>Outputs one message line (into the logs) for each parameter. The
script is responsible for formatting.</dd>
<dt><tt>putenv(...)</tt></dt>
<dd>Puts the given environment strings into the session environment.
The strings must be in the form "<tt>NAME=VALUE</tt>"</dd>
<dt><tt>setenv(name, value, overwrite)</tt></dt>
<dd>Sets a session environment variable which may be used by other
plugins to modify their behavior. Does not return any values. Raises
an error if any problems occur.</dd>
<dt><tt>setnum(name, value)</tt></dt>
<dd>Sets the named session number. These numbers may be used by other
plugins to modify their behavior. For example,
the <a href="plugin-counters.html">counters plugin</a> uses the minimum
value of the session environment variable <tt>$DATABYTES</tt> and the
session number <tt>maxdatabytes</tt> for the maximum message size.</dd>
<dt><tt>setstr(name, value)</tt></dt>
<dd>Sets the named session string. These strings may be used by other
plugins to modify their behavior. For example,
the <a href="plugin-add-received.html">add-received plugin</a> uses
the <tt>helo_domain</tt> string in the header(s) it generates.</dd>
</dl>
</body>
</html>
|