167 |
@* |
@* |
168 |
Optional. This specifies the basic GNU Anubis behavior. |
Optional. This specifies the basic GNU Anubis behavior. |
169 |
@item |
@item |
170 |
@dfn{The ALL section}. |
@dfn{The GUILE section}. |
171 |
@* |
@* |
172 |
Optional. This specifies what jobs GNU Anubis does for @emph{all} |
Optional. |
|
your outgoing messages. |
|
|
|
|
173 |
@item |
@item |
174 |
@dfn{The Rule System}. |
@dfn{The Rule System}. |
175 |
@* |
@* |
176 |
Optional. Here you can define your own processing rules |
Optional. Here you can define your own processing rules |
177 |
for any particular message. |
for any particular message (conditional or unconditional |
178 |
|
rules). |
179 |
@end enumerate |
@end enumerate |
180 |
|
|
181 |
@menu |
@menu |
182 |
* CONTROL Section:: |
* CONTROL Section:: |
183 |
* TRANSLATION Section:: |
* TRANSLATION Section:: |
184 |
* ALL Section:: |
* GUILE section:: |
185 |
* Rule System:: |
* Rule System:: |
186 |
@end menu |
@end menu |
187 |
|
|
390 |
@end example |
@end example |
391 |
|
|
392 |
|
|
393 |
@node TRANSLATION Section, ALL Section, CONTROL Section, Configuration |
@node TRANSLATION Section, GUILE section, CONTROL Section, Configuration |
394 |
@section The TRANSLATION Section |
@section The TRANSLATION Section |
395 |
@cindex TRANSLATION section, The |
@cindex TRANSLATION section, The |
396 |
|
|
430 |
the local john's configuration file. |
the local john's configuration file. |
431 |
|
|
432 |
|
|
433 |
@node ALL Section, Rule System, TRANSLATION Section, Configuration |
@node GUILE section, Rule System, TRANSLATION Section, Configuration |
434 |
@section The ALL Section |
@section The GUILE section |
435 |
@cindex ALL section, The |
@cindex GUILE section, The |
436 |
|
@cindex Guile |
437 |
This section specifies a behavior of an outgoing mail processor |
@cindex Scheme |
|
in the case of @emph{every} outgoing message (unconditional rules). |
|
|
This section is available @emph{only} in the user configuration file. |
|
|
The @samp{ALL} section starts with the @w{@code{---BEGIN ALL---}} line, |
|
|
and the @w{@code{---END---}} line ends it. Syntax: |
|
|
|
|
|
@example |
|
|
@group |
|
|
---BEGIN ALL--- |
|
|
@var{action-list} |
|
|
---END--- |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
@noindent |
|
|
@xref{Action List}, for details. |
|
438 |
|
|
439 |
An example: |
[This section is missing :-P] |
440 |
|
|
|
@example |
|
|
@group |
|
|
---BEGIN ALL--- |
|
|
signature-file-append = yes |
|
|
---END--- |
|
|
@end group |
|
|
@end example |
|
441 |
|
|
442 |
@noindent |
@node Rule System, , GUILE section, Configuration |
|
The example above will add the @file{~/.signature} file to @emph{every} |
|
|
outgoing message! |
|
|
|
|
|
|
|
|
@node Rule System, , ALL Section, Configuration |
|
443 |
@section The Rule System (The RULE Section) |
@section The Rule System (The RULE Section) |
444 |
@cindex Basic regular expressions |
@cindex Basic regular expressions |
445 |
@cindex Extended regular expressions |
@cindex Extended regular expressions |
477 |
@subsection Grammar (The Rule System) |
@subsection Grammar (The Rule System) |
478 |
@cindex grammar |
@cindex grammar |
479 |
|
|
480 |
General syntax: |
[This section is missing :-P] |
|
|
|
|
@example |
|
|
@group |
|
|
if @var{where} [: @var{options}] =@var{regex1}[ != @var{regex2}] |
|
|
@var{action-list} |
|
|
fi |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
@noindent |
|
|
Each rule starts with the @samp{if} command, and ends with the @samp{fi} |
|
|
or @samp{done} command. The first regular expression (@var{regex1}) is |
|
|
required. The second one (@var{regex2}) is optional. Here is a simple rule: |
|
|
|
|
|
@example |
|
|
@group |
|
|
if @var{where} =@var{regex1} |
|
|
@var{action-list} |
|
|
fi |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
@noindent |
|
|
The rule above is true if @var{regex1} is @emph{true}. |
|
|
Another way: |
|
|
|
|
|
@example |
|
|
@group |
|
|
if @var{where} =@var{regex1} != @var{regex2} |
|
|
@var{action-list} |
|
|
fi |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
@noindent |
|
|
The rule above is true if @var{regex1} is @emph{true} and @var{regex2} |
|
|
is @emph{false}. The control operator @code{@key{SPC}!=@key{SPC}} breaks |
|
|
regular expressions into two pieces: @var{regex1} and @var{regex2}. |
|
|
|
|
|
@strong{Caution:} The @var{where} means @samp{COMMAND} or @samp{HEADER}, |
|
|
for example: |
|
|
|
|
|
@example |
|
|
@group |
|
|
---BEGIN RULE--- |
|
|
if COMMAND [: @var{options}] =@var{regex1}[ != @var{regex2}] |
|
|
@var{action-list} |
|
|
fi |
|
|
if HEADER [: @var{options}] =@var{regex1}[ != @var{regex2}] |
|
|
@var{action-list} |
|
|
fi |
|
|
---END--- |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
@noindent |
|
|
@samp{COMMAND} says to match this regexp against all the SMTP/ESMTP commands, |
|
|
like @samp{helo}, @samp{ehlo}, @samp{mail from}, @samp{rcpt to}, @samp{data}, |
|
|
@samp{quit}, etc. |
|
|
|
|
|
@example |
|
|
@group |
|
|
if COMMAND =^mail from:.*<?john@@localhost>? |
|
|
@var{action-list} |
|
|
fi |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
@noindent |
|
|
@samp{HEADER} says to match this regexp against all the header |
|
|
lines in the message. We often use thus with a regexp that matches |
|
|
only a particular kind of header line---for instance, the regexp |
|
|
@samp{^Subject:} will only match a @samp{Subject} header line. |
|
|
But this is not a requirement. You can use any regexp you wish, |
|
|
and it will have a chance to match every header line in the message. |
|
|
|
|
|
@example |
|
|
@group |
|
|
if HEADER [: @var{options}] =^Subject: test |
|
|
@var{action-list} |
|
|
fi |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
The @var{options} area is optional, and it allows you to specify any extra |
|
|
option for a particular regexp match. The @var{options} area must be preceded |
|
|
with a colon (@samp{:}). The following options are acceptable: @samp{basic}, |
|
|
@samp{perlre}, @samp{scase}. |
|
|
|
|
|
@table @samp |
|
|
@item basic |
|
|
This option forces @dfn{POSIX Basic Regular Expression} syntax when |
|
|
interpreting regex instead of @dfn{POSIX Extended Regular Expression} |
|
|
(Extended is the default). |
|
|
|
|
|
@item perlre |
|
|
This option forces @dfn{Perl Regular Expression} syntax when interpreting |
|
|
regex instead of @dfn{POSIX Extended Regular Expression}. To enable this |
|
|
option, you must compile GNU Anubis, specifying @code{./configure --with-pcre}. |
|
|
|
|
|
@item scase |
|
|
This option makes a particular regular expression case sensitive. |
|
|
By default, all regular expressions are case insensitive. |
|
|
@end table |
|
|
|
|
|
An example: |
|
|
|
|
|
@example |
|
|
@group |
|
|
if header : perlre scase =^Subject: HeLlo |
|
|
@var{action-list} |
|
|
fi |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
@noindent |
|
|
In this case, the Perl regular expression syntax will be used instead of |
|
|
POSIX extended version, and case sensitivity will be set. |
|
|
|
|
|
@strong{Caution:} Do not mix the @samp{perlre} option with @samp{basic} option. |
|
|
If you specify the Perl regular expression, then you cannot use the POSIX |
|
|
Basic syntax, and vice versa. |
|
|
|
|
|
The whole rule system is case insensitive (even regular expressions, |
|
|
unless you specify the @samp{scase} option), so you can write for instance: |
|
|
|
|
|
@example |
|
|
@group |
|
|
IF HeAdEr =@var{regex1}[ != @var{regex2}] |
|
|
@var{action-list} |
|
|
FI |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
General example: |
|
|
|
|
|
@example |
|
|
@group |
|
|
---BEGIN RULE--- |
|
|
if header =^Subject: != ^Subject: URGENT |
|
|
signature-file-append = yes |
|
|
fi |
|
|
---END--- |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
@noindent |
|
|
The example above will add the @file{~/.signature} file, except an email |
|
|
with a subject @samp{urgent} (case insensitive). No extra options have |
|
|
been specified in this example. |
|
481 |
|
|
482 |
|
|
483 |
@node Action List, Trigger, Grammar, Rule System |
@node Action List, Trigger, Grammar, Rule System |
488 |
of an outgoing messages. All action command names are case insensitive, so you |
of an outgoing messages. All action command names are case insensitive, so you |
489 |
can use for instance: @samp{add} or @samp{ADD} or @samp{AdD}, and so on. |
can use for instance: @samp{add} or @samp{ADD} or @samp{AdD}, and so on. |
490 |
|
|
491 |
|
@strong{Caution:} Some action commands below might not be compatible |
492 |
|
with GNU Anubis > 3.6.2, because this Manual has not been updated for |
493 |
|
a long time. |
494 |
|
|
495 |
@menu |
@menu |
496 |
* Editing Headers:: How to edit a message header on-the-fly. |
* Editing Headers:: How to edit a message header on-the-fly. |
497 |
* Inserting Files:: How to append text files to an outgoing message. |
* Inserting Files:: How to append text files to an outgoing message. |
734 |
@node Quick Example, , Command Summary, Action List |
@node Quick Example, , Command Summary, Action List |
735 |
@subsubsection Quick Example |
@subsubsection Quick Example |
736 |
|
|
737 |
Here is a quick example of using an action list: |
[This section is missing :-P] |
|
|
|
|
@example |
|
|
@group |
|
|
---BEGIN RULE--- |
|
|
if header =^X-Mailer: |
|
|
remove =^X-Mailer: |
|
|
add = X-Comment: GNU's Not Unix! |
|
|
gpg-sign = @var{your passphrase} |
|
|
signature-file-append = yes |
|
|
fi |
|
|
---END--- |
|
|
@end group |
|
|
@end example |
|
|
|
|
|
@noindent |
|
|
The example above will remove (on-the-fly) the @samp{X-Mailer:} line from |
|
|
an outgoing message, add an extra header line (@samp{X-Comment:}), sign your |
|
|
message with your private key, and add a simple signature file from your |
|
|
home directory. |
|
738 |
|
|
739 |
|
|
740 |
@node Trigger, , Action List, Rule System |
@node Trigger, , Action List, Rule System |
747 |
|
|
748 |
@example |
@example |
749 |
@group |
@group |
750 |
rule [: @var{options}] =^@var{rule-name} |
rule [:@var{tags}] "@var{rule-name}" |
751 |
@var{action-list} |
@var{action-list} |
752 |
done |
done |
753 |
@end group |
@end group |
754 |
@end example |
@end example |
755 |
|
|
|
@noindent |
|
|
@strong{Caution:} Plase note that there is no space after the @samp{=} |
|
|
character. |
|
|
|
|
756 |
An example: |
An example: |
757 |
|
|
758 |
@example |
@example |
759 |
@group |
@group |
760 |
---BEGIN RULE--- |
---BEGIN RULE--- |
761 |
rule =^gpg-encrypt-john |
rule "gpg-encrypt-john" |
762 |
gpg-encrypt = john's_gpg_key |
gpg-encrypt = john's_gpg_key |
763 |
done |
done |
764 |
---END--- |
---END--- |
778 |
@example |
@example |
779 |
@group |
@group |
780 |
---BEGIN RULE--- |
---BEGIN RULE--- |
781 |
rule =^gpg-encrypt:(.*) |
rule "gpg-encrypt:(.*)" |
782 |
gpg-encrypt = \1 |
gpg-encrypt = \1 |
783 |
add = X-GPG-Comment: Encrypted for \1 |
add = X-GPG-Comment: Encrypted for \1 |
784 |
done |
done |