User Tools

Site Tools


reference:autoresponder_global_script

Autoresponder Global Scripting

For scripting to modify the autoresponder text which is embedded in the autoresponder itself, see Autoresponder Scripting

The Autoresponder Global Script is executed for every autoresponse. It is stored in the 'Autoresponder.lua' script in Settings → Scripts

It can contain two function hooks. For each of these, there are two global variables set:

  • Autoresponder - this is a table with the following fields:
    • ID - the numeric ID of the autoresponder
    • OwnerID - the numeric ID of the autoresponder's owner
    • Name - the name of the autoresponder
    • Text - the text of the autoresponder
    • Keep - whether the autoresponder is set to keep the original message
    • CheckLog - how far back (in hours) the autoresponder should check for previous messages from the same sender
    • Sender - the sender to use in the autoresponse
    • ReplyTo - the reply-to address to use in the autoresponse
    • Subject - the subject replacement for the autoresponse (cannot be used with SubjectPrefix)
    • SubjectPrefix - text to prefix to the original subject for the autoresponse (cannot be used with Subject)
    • AppendMsg - whether the original message should be appended to the autoresponse
    • To - table containing the email addresses the autoresponse should go to (a '*' value indicates the default email address - usually the original message sender)
    • Attachments - table containing the names of the attachments for the autoresponse
    • CopyTo - table containing email addresses the original message should be copied to
  • AutoresponderRule - this is the autoresponder condition which matched and triggered the autoresponder - this is a table with the following fields:
    • ID - the numeric ID of the autoresponder rule
    • Autoresponder ID - the numeric ID of the autoresponder associated with this rule
    • FireAutoresponder - boolean indicating whether the autoresponder will be generated or not
    • RuleEnabled - boolean indicating whether the autoresponder rule is enabled
    • Priority - the priority of the autoresponder rule (the order they are checked)
    • AutoresponderOwnerID - the numeric ID of the owner of the autoresponder
    • AutoresponderOwner - the name of the owner of the autoresponder (blank if it's a global autoresponder template)
    • Name - the name of the autoresponder rule
    • DateFrom - the Date From field of the rule
    • DateTo - the Date To field of the rule
    • TimeFrom - the Time From field of the rule
    • TimeTo - the Time To field of the rule
    • DateTimeFrom - the DateTime From field of the rule
    • DateTimeTo - the DateTime To field of the rule
    • DaysOfWeek - the days of week that the rule will be triggered on (text string containing numbers 0 to 6 for the days of week)
    • Sender - the Sender field of the rule
    • Subject - the Subject field of the rule
    • Locked - boolean indicating whether the rule is locked
    • Matches - number showing the number of times the rule has matched
    • Custom Fields - table containing the custom fields for the rule

PreProcessAutoresponder

This allows the script to see the autoresponder data before the autoresponse is generated and potentially alter the autoresponder definition to be used during generation.

PreProcessAutoresponder(username, incoming_message)
  • username = the user name which has triggered the autoresponder
  • incoming_message = the incoming message (including headers). This is truncated at 100,000 bytes

The function can alter the Autoresponder global variable, and the altered version will be used for the rest of the autoresponder processing. If the Text field is set to blank, then the autoresponse will be skipped (and any side-effects, such as copying the original message will also be skipped)

PostProcessAutoresponder

This allows the script to see the autoresponder data after the autoresponse is generated, and potentially alter relevant data

PostProcessAutoresponder(username, generated_message, incoming_message)
  • username = the user name which has triggered the autoresponder
  • generated_message = the generated autoresponder message text
  • incoming_message = the incoming message (including headers). This is truncated at 100,000 bytes

The function returns one value, which is the new autoresponder message text. So, it should at least return the second parameter provided to it. If this is blank, then the autoresponse will not be generated, and any side-effects will not take place.

There are extra global variables provided to the PostProcessAutoresponder function as well as the Autoresponder and AutoresponderRule global variables described above.

The function can alter the Autoresponder global variable as well as most of the global variables listed below:

  • From - the originator email address of the autoresponse (read/write)
  • ReturnPath - the return path of the autoresponse (read/write)
  • Subject - the subject of the autoresponse (read/write)
  • ReplyTo - the ReplyTo email address of the autoresponse (read/write)
  • RespondTo - the default email address where the autoresponse will be sent (read/write) (see also the Autoresponder.To field)
  • Headers - a table containing custom headers of the autoresponse (read/write)
  • RFC3834 - a boolean indicating whether the RFC3834 global setting is set in VPOP3 (read-only)
reference/autoresponder_global_script.txt · Last modified: 2025/05/28 10:50 by paul