User Tools

Site Tools


reference:signature_script

Signature Script

If you want more complex signatures on outgoing emails, rather than the static text/HTML you can define within VPOP3, then you can use a simple Lua script to define the signature.

The Lua script is stored in a file called signature.lua in the VPOP3 directory in VPOP3 v6.6 and earlier, or managed through the Settings → Scripts page in VPOP3 v6.7 and later.

VPOP3 calls a function called GetSignature which should have the following prototype:

GetSignature(<format>, <authenticated sender>, <sender email address>)

(where '<format>' is either “HTML” or “PLAIN”)

In v6.7+, the message subject is also passed to the function:

GetSignature(<format>, <authenticated sender>, <sender email address>, <subject>)

In v6.9+, a table is passed containing the LDAP attributes for the authenticated sender (if any)

GetSignature(<format>, <authenticated sender>, <sender email address>, <subject>, <LDAP Data>)

The LDAP data table is a table of tables which consists of a table where the index is the LDAP attribute name (in upper case), and the data is a table with numeric indices starting from 1, where the data is the LDAP attribute value, so you could have, for instance, LDAP["CN"][1] = "Fred Bloggs". This is because it is allowed to have duplicate LDAP attributes, so all the CN attributes are put into a single table, etc.

This function should return a string which tells VPOP3 which signature to use (if there isn't a return value, VPOP3 will use the signature configured in VPOP3).

A simple example would be:

function GetSignature(Type, AuthSender, Sender)
 if string.find(Sender, "@domain1%.com$") then
  if Type == "PLAIN" then
   return "This is the signature for domain1"
  else
   return "<p>This is the HTML signature for domain1</p>"
  end
 elseif string.find(Sender, "@domain2%.com$") then
  if Type == "PLAIN" then
   return "This is the signature for domain2"
  else
   return "<p>This is the HTML signature for domain2</p>"
  end
 end
end

If you need, we can produce a script for you, but there would be a cost for this - contact support@pscs.co.uk with a specification for a quote. (The price is usually £50 + VAT for a simple case with 2 or 3 signatures which are fixed depending on the sender. If you want signatures which vary (eg contain the date/time) or more different signatures, or reading signatures from a file, then we would need to know the exact specification to be able to give you a quote.

reference/signature_script.txt · Last modified: 2018/11/14 10:45 by 127.0.0.1