reference:management_scripting

Management Scripting

In VPOP3 Enterprise, from version 6.17 there is the facility to run Lua scripts manually or according to a schedule. These scripts can do things like access mail folders & messages and perform some maintenance on them.

Creating a new script

In Settings → Scripts you can create a new script by typing the name in the box to the left of the New box and pressing 'New'

Manually running a script

You can press the Run button to run the script you have entered (this does not save the script, so you may want to save it first). This will run the script. If you want to test a function then you will need to write a bit of Lua to call the function, eg:

myFunction(3);

function myFunction(x)
 print(x * 7);
end

The print output and any runtime errors will be displayed above the script after the script has completed.

Scheduling scripts

VPOP3 will run a script called scheduler.lua in the background, it will periodically call functions in this script at approximately 1 minute, 5 minute, 1 hour and 1 day intervals.

See the scheduling management scripts article for more information.

Management script functions

Any script run manually or via scheduler.lua will have access to several management functions as well as the functions described here

Note that these times are approximate because the background process performs other tasks which may take time, so these intervals should not be relied upon. It will wait for the script to return before continuing, so if the '1 minute' script takes 10 minutes to run, it will run it again soon after the first one has completed, rather than having 10 copies of the script running at once.

reference/management_scripting.txt · Last modified: 2018/11/14 10:45 by 127.0.0.1