User Tools

Site Tools


Autoresponder scripting

In an autoresponder, you can create a Lua script by surrounding it with <lua> & </lua> tags, eg

This is an autoresponder with some Lua in it <lua>print 73</lua>

The Lua script is executed with the following global variables

  • Message - the original message content
  • Autoresponder - the autoresponder definition being used (see below)
  • User - the user account name
  • Originator - the originator email address
  • OrigSubject - the original subject
  • Date, LongDate, ShortDate, Time, TimeNoSecs - the current date & time in different, locale-dependent, forms
  • conditionname - the autoresponder condition name which matched for the autoresponder to fire
  • conditiondatefrom, conditiondateto, conditiontimefrom, conditiontimeto, conditiondatetimefrom, conditiondatetimeto, conditiondow, conditionmatches, customfield_x - autoresponder condition data
  • StartDate - the start date of the condition in local-dependent format (or “unknown”)
  • EndDate - the end date of the condition in local-dependent format (or “unknown”)

After the script has been called, the Keep, CheckLog, Sender, ReplyTo, Subject, SubjectPrefix, AppendMsg, To, CopyTo and Attachments fields of the Autoresponder defined in the Lua global variable are read back into the current autoresponder definition. This means, for instance, that you can use Autoresponder.Keep = false; to change the autoresponder not to keep the original message.

If there are multiple <lua> segments in an autoresponder, they are processed from the top down, and the Autoresponder variable one sees is the affected by the previous ones.

The print output of the Lua script gets written to the autoresponse.

Autoresponder Definition

The Autoresponder global variable 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
  • Attachments - table containing the names of the attachments for the autoresponse
  • CopyTo - table containing email addresses the original message should be copied to
reference/autoresponder_script.txt · Last modified: 2018/11/14 10:45 by