45.6. Conditional Blocks and Include Files

A conditional block is a group of actions and variable assignments in the Procmail configuration file that is only processed if some conditions match. They can be used to create quite complex sets of actions, almost like a programming language. The Procmail Mail Filter module allows you to create and edit conditional blocks, but displays their contents as just configuration file text rather than parsing the actions that they contain. This means that you have to be familiar with the Procmail file format to use them.

To create an conditional block, follow these steps:

1.
Click on Add a new conditional block below the list of actions on the module's main page.

2.
In the Procmail code to execute text box, enter the configuration file lines for the actions or variable assignments to be processed if the conditions match. As soon as any action in the block matches, processing of the entire configuration file will stop. If none match, however, processing will continue as usual with the next action after the block.

See the procmailrc manual page in the System Documentation module for details of the format.

3.
Fill in the Action conditions section just as you would for a normal action, as explain in Section 45.4 “Creating and Editing Actions”.

4.
Hit the Create button to create the new block.

As with actions, you can edit or delete a conditional block by clicking on it in the list on the module's main page. The entire block can also be moved around with the up and down arrows.

An include file is a special directive that tells Procmail to read and process a separate configuration file in the same format as /etc/procmailrc. Some spam-filtering programs are actually just Procmail files that can be included in your primary configuration. To create an include directive, follow these steps:

1.
Click on the Add a new include file link on the module's main page.

2.
In the Included file field on the form that appears, enter the full path to the other configuration file. You can also enter a relative path, in which case Procmail will search for that file in the home directory of the UNIX user to whom that mail is being delivered. When handling an include, Procmail will stop processing altogether as soon as it finds a matching action in the file. If none are found, it will continue processing the actions that come after the include in the primary configuration file.

3.
Hit the Create button to finish the process.

Normally, includes are listed on the module's main page just like actions and variable assignments, and can be edited, deleted, or moved about. If the Show contents of include files? setting is enabled on the Module Config page, however, the module will display the actual actions inside the include file for you to edit or delete. They can even be moved up and down, although only within the file. Enabling this option is not a good idea if you have a massive include file (such as one for spam filtering), as it will make the module's main page unusably large. If the include file path contains a reference to a variable, its contents will never be shown by the module as Webmin has no reliable way to work out the value of Procmail variables in advance.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.253.223