User Tools

Site Tools


reference:outgoing_message_script

This is an old revision of the document!


Outgoing Message Scripting

Every time VPOP3 adds a message to the Outgoing mail queue, it runs a script called outmessage.lua.

Scripts are stored as files in the VPOP3 directory in VPOP3 v6.6 and earlier, or managed through the Settings → Scripts page in VPOP3 v6.7 and later.

Messages to be sent

For every message which is to be sent VPOP3 calls a function in that script called NewMessage.

The function signature is: NewMessage(AuthenticatedSender, ReturnPath, CreationDate, Subject, SenderIPAddress, FileLength, Priority, Headers, Message, HoldSeconds, DeleteAfterSeconds)

  • AuthenticatedSender - The VPOP3 username of the user who authenticated to send the message (if authentication wasn't used, this is blank).
  • ReturnPath - The email address of the sender (strictly speaking, the SMTP return path/MAIL FROM address, which is where bounce messages will be sent).
  • CreationDate - The time the message was created - as YYYYMMDDHHMMSS.
  • Subject - The subject of the message.
  • SenderIPAddress - The IP address of the message sender (if generated from within VPOP3/forwarded/etc, this will be blank).
  • FileLength - The size of the message file - this will be slightly longer than the message itself because of control data, but can be used as an estimate.
  • Priority - The current priority of the message. VPOP3 will send messages with a smaller priority number first.
  • Headers - A list of the message header lines in raw form.
  • Message - The message content in raw form (single string, includes raw headers).
  • HoldSeconds - The current number of seconds the message will be held before being sent (0 = no time).
  • DeleteAfterSeconds - The current number of seconds before the message will be deleted from the queue (0 = never).

The function returns a table of new settings. This can contain the following fields. If the field doesn't exist, then the value is not changed.

  • Priority - The new priority of the message. VPOP3 will send messages with a smaller priority number first.
  • HoldReason - A reason to be logged in the database for why the message is held.
  • Hold - If this is set to 'true', '1', 't', 'hold' then the message is held, otherwise it is not held.
  • HoldUntil - If this is set to a string like YYYYMMDDHHMMSS then the message is held until that time, otherwise it is held for the specified number of seconds.
  • DeleteAfter - If this is set to 'none', then it is never deleted. If this is set to a string like YYYYMMDDHHMMSS then the message will be deleted after that time, otherwise it will be deleted after the specified number of seconds.
reference/outgoing_message_script.1423563439.txt.gz · Last modified: 2018/11/14 10:44 (external edit)