reference:archive_script

Archive Script

(from VPOP3 v6 onwards)

Archive scripting lets you indicate whether full message content should be stored in the message archive. This could be used, for instance, for filtering out messages containing credit card details.

The message headers will still be archived, along with the explanation text returned by the script.

The Lua script is stored in a file called archive.lua which is stored in the VPOP3 directory in VPOP3 v6.6 and earlier, or managed through the Settings → Scripts page in VPOP3 v6.7 and later.

VPOP3 calls a function called ArchiveRules which should have the following prototype:

ArchiveRules(<return path>, <subject>, <time>, <type>, <sender email>, <authenticated sender>, <ip address>, <message-id>, <size>, <attachments>, <recipients>, <references>, <header>, <content>)

This function should return a string which sets the explanation of why the message should not be archived - this explanation is stored in the archived message. If there isn't a return value, or the returned string is blank, VPOP3 will archive the message as normal.

A simple example would be:

function ArchiveRules(retpath, subject, time, type, from, authsender, ipaddr, msgid, size, attch, recipients, references, header, content)

if (subject == "bibble") then
	return "BibbleTest";
end

end

If you need, we can produce a script for you, but there would be a cost for this - contact support@pscs.co.uk with a specification for a quote.

Custom Archive Store functions

(from VPOP3 v8.4 onwards)

These functions allow the archive to be stored on a non-standard file store - eg an FTP server, or Amazon S3-like system, etc. The functions can perform things like encryption, compression etc, as long as they can reverse the process correctly.

There are a set of functions which perform uploads, downloads, check for presence of message file, etc.

CustomStore_Check

CustomStore_Check()

* Returns an empty string if the custom store is accessible, or an error response (which is logged) if it is inaccessible

CustomStore_Upload

CustomStore_Upload(local_filename, archive_filename)

Uploads 'local_filename' and makes it accessible online as 'archive_filename'. In the future, the message will be referred to using 'archive_filename'

  • Returns two values
    1. Upload succeeded (true/false)
    2. Want a local store as well (true/false)

CustomStore_Get

CustomStore_Get(archive_filename, local_filename)

Downloads 'archive_filename' and stores it locally as 'local_filename'

CustomStore_CheckGet

CustomStore_CheckGet(archive_filename)

Checks if 'archive_filename' is available on the custom store

  • Returns true if the file is available
reference/archive_script.txt · Last modified: 2023/03/25 23:33 by paul