Difference between revisions of "Spamd (Sieve test)"
(Initial revision) |
m (→Syntax) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
==Syntax== | ==Syntax== | ||
− | spamd [:host <'' | + | spamd [:host <''inet-host'': string>] |
− | [:port <'' | + | [:port <''inet-port'': number> / :socket <''unix-socket'': string>] |
[:user <''name'': string>] | [:user <''name'': string>] | ||
[:over" / :under <''limit'': string>] | [:over" / :under <''limit'': string>] | ||
Line 10: | Line 10: | ||
The ''spamd'' test is an interface with <tt>spamd</tt> daemon, which is a part of ''SpamAssassin'' mail filter. The test evaluates to <tt>True</tt> if ''SpamAssassin'' recognized the message as spam, or the message spam score satisfies the given relation. | The ''spamd'' test is an interface with <tt>spamd</tt> daemon, which is a part of ''SpamAssassin'' mail filter. The test evaluates to <tt>True</tt> if ''SpamAssassin'' recognized the message as spam, or the message spam score satisfies the given relation. | ||
− | If the argument is <tt>:over</tt> and the spam score is greater than or equal to the number provided, the test is | + | If the argument is <tt>:over</tt> and the spam score is greater than or equal to the number provided, the test is <tt>True</tt>; otherwise, it is <tt>False</tt>. |
If the argument is <tt>:under</tt> and the spam score is less than or equal to the number provided, the test is <tt>True</tt>; otherwise, it is <tt>False</tt>. | If the argument is <tt>:under</tt> and the spam score is less than or equal to the number provided, the test is <tt>True</tt>; otherwise, it is <tt>False</tt>. | ||
Spam score is a floating point number. The comparison takes into account three decimal digits. | Spam score is a floating point number. The comparison takes into account three decimal digits. | ||
+ | |||
+ | The <tt>spamd</tt> socket to use is configured via the <tt>:host/:port</tt> or <tt>:socket</tt> tags. | ||
+ | |||
+ | The <tt>:host</tt> tag instructs <tt>spamd</tt> to connect to the INET socket on host ''tcp-host''. The <tt>:port</tt> tag supplies the port to use. If not specified, the <tt>spamd</tt> default port 783 is assumed. | ||
+ | |||
+ | The <tt>:socket</tt> tag argument instructs <tt>spamd</tt> to connect to the given UNIX socket. The argument is an absolute file name of the socket file. | ||
+ | |||
+ | If neither <tt>:host</tt> not <tt>:socket</tt> are given, <tt>:host 127.0.0.1 :port 783</tt> will be used. | ||
==Example== | ==Example== | ||
<source lang="C"> | <source lang="C"> | ||
+ | require "test-spamd"; | ||
+ | |||
if spamd :host "127.0.0.1" :user "gray" :over "9.5" | if spamd :host "127.0.0.1" :user "gray" :over "9.5" | ||
{ | { | ||
Line 26: | Line 36: | ||
[[Category:Sieve]] | [[Category:Sieve]] | ||
− | [[Category:Sieve | + | [[Category:Sieve Tests]] |
− | [[Category:Sieve | + | [[Category:Sieve Extensions]] |
Latest revision as of 00:12, 25 December 2010
Spamd is a Sieve test implemented as a loadable extension.
Syntax
spamd [:host <inet-host: string>] [:port <inet-port: number> / :socket <unix-socket: string>] [:user <name: string>] [:over" / :under <limit: string>]
The spamd test is an interface with spamd daemon, which is a part of SpamAssassin mail filter. The test evaluates to True if SpamAssassin recognized the message as spam, or the message spam score satisfies the given relation.
If the argument is :over and the spam score is greater than or equal to the number provided, the test is True; otherwise, it is False.
If the argument is :under and the spam score is less than or equal to the number provided, the test is True; otherwise, it is False.
Spam score is a floating point number. The comparison takes into account three decimal digits.
The spamd socket to use is configured via the :host/:port or :socket tags.
The :host tag instructs spamd to connect to the INET socket on host tcp-host. The :port tag supplies the port to use. If not specified, the spamd default port 783 is assumed.
The :socket tag argument instructs spamd to connect to the given UNIX socket. The argument is an absolute file name of the socket file.
If neither :host not :socket are given, :host 127.0.0.1 :port 783 will be used.
Example
require "test-spamd";
if spamd :host "127.0.0.1" :user "gray" :over "9.5"
{
discard;
}