User Tools

Site Tools


reference:attachment_extraction_script

Attachment Extraction Scripting

This is the 'extraction.lua' script.

(Added in V6.17)

This script has one functions:

  • Extract

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:

  1. 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
  2. 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)

Example

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
reference/attachment_extraction_script.txt · Last modified: 2018/11/14 10:45 by 127.0.0.1