======POP3 Client Lua Scripting====== The POP3 Client [[http://wiki.pscs.co.uk/reference;lua_scripting|Lua Script]] is called POP3CLT.LUA and is edited in Settings -> Scripts. This script is called whenever VPOP3 runs a POP3 session to download messages from a remote POP3 server. VPOP3 will call the following Lua functions in the script at the following times: * **Start()** - called when the POP3 session starts, before VPOP3 starts downloading any messages. * **DownloadRules()** - called before each message is downloaded to determine how VPOP3 should handle the message. A scripted version of normal [[http://www.pscs.co.uk/manual/download_rules.html|Download Rules]] in VPOP3. * **StartMessage()** - called just before VPOP3 starts downloading a message from the remote server. * **MessageLineRaw()** - called when VPOP3 has downloaded a line of a message from the remote server. * **MessageLine()** - called after VPOP3 has processed a line of a message from the remote server,just before it saves it. * **EndMessage()** - called when VPOP3 has finished downloading a message from the remote server. * **ProcessMessage()** - called after VPOP3 has downloaded a message from the remote server to determine if any special actions need to be performed on the message. * **End()** - called at the end of the POP3 session. =====ProcessMessage()===== ''ProcessMessage("", "", , , , , )'' This function is called by VPOP3 when a message has been received by the SMTP service. * is the SMTP 'MAIL FROM' address * is the message subject line * is a table containing a list of the recipient email addresses (from the RCPT TO envelope) * is a table with the following entries * SendToOriginalRecipients boolean - should the message be sent to the originally specified recipients * Delete boolean - should the message be deleted after retrieving * Ignore boolean - should the message be ignored * Reason string - text string to use if a reason is needed for the action * Recipients table - table containing new/replacement recipients for the message * HeaderModifiers table - list of message header modifications to make * is a table with one or more of the following entries * Path string - the IMAP style path to the message section * ContentType string - the main content type (eg 'text', 'image' etc) * ContentSubtype string - the content subtype (eg 'html', 'plain', 'gif', etc) * ContentTypeFilename string - the filename from the ContentType header * ContentDisposition string - usually 'inline' or 'attachment' or blank * ContentDispositionFilename string - the filename from the ContentDisposition header * Start number - the offset from the start of the message where this section starts * End number - the offset from the start of the message where this section ends * is the size of the message in bytes * is a table with zero or more of the following entries, referring to the attachments in the message * MIMESection number - the MIME section that this attachment occurred in * Name string - the name of the attachment * MIMEType string - the MIME type of the attachment * Size number - the size of the attachment * Type string - the type of attachment (MIME, UUE, BINHEX, MIMEUUE, MIMEBINHEX, TNEF) This function should return , In this function the [[lua_scripting#only_in_pop3cltlua_and_smtpsvrlua_processmessage_function|VPOP3 ProcessMessage helper functions]] can be used.