reference:lua_pop3_client_script

POP3 Client Lua Scripting

The POP3 Client 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 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(“<mailfrom>”, “<subject>”, <recipient list>, <current actions>, <message MIME structure>, <message size>, <attachments>)

This function is called by VPOP3 when a message has been received by the SMTP service.

  • <mailfrom> is the SMTP 'MAIL FROM' address
  • <subject> is the message subject line
  • <recipient list> is a table containing a list of the recipient email addresses (from the RCPT TO envelope)
  • <current actions> 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
  • <message MIME structure> 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
  • <message size> is the size of the message in bytes
  • <attachments> 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 <new actions table>, <results string>

In this function the VPOP3 ProcessMessage helper functions can be used.

reference/lua_pop3_client_script.txt · Last modified: 2023/08/16 07:48 by paul