This is the 'extraction.lua' script.
(Added in V6.17)
This script has one functions:
This functions is called if the attachment extraction is enabled in Settings → Attachment Processing → Extraction.
For every message VPOP3 loads the script file, then for each (non-virus) attachment it calls
Extract(attachmentname, sender, subject, copy, targetdirectory)
attachmentname - the filename of the attachment in the message
sender - the email address of the sender
subject - the subject of the message
copy - whether the VPOP3 settings indicate that the attachment will be copied to the target directory (true) or moved to the target directory and deleted from the message (false)
targetdirectory - the target directory determined by the VPOP3 settings
The functions return two values:
an 'operation' id : 0 = don't save the attachment to file, and leave it in the message, 1 = save the attachment and delete it from the message, 2 = save the attachment and leave it in the message
the directory to save the attachment to (if operation <> 0). This can just be 'targetdirectory' or something else. (In v6.20 and later this can contain the standard expansions for the extraction directory)
A simple example could be:
function Extract(attach, sender, subject, copyatt, attdir)
print(attach,sender,subject,copyatt,attdir); -- log the details to lua.out
return 2, "%base%\\_attach2"; --copy the attachment to the VPOP3\\_attach2 folder
end