User Tools

Site Tools


reference:spamrules_addrandomtexttosubject

Use the spam filter scripting to add random text to the subject on incoming messages

This needs VPOP3 version 5 or later.

This script is for the case where you want a message to the 'support' user to have the text [XXX-99999] added to an incoming message's subject if it does not already exist. Some people want this text to use as reference numbers for a “light” version of a ticket help desk. Note that this script will not check for uniqueness of the reference numbers, so there is a small chance they will be repeated.

Add the following to the spamrules_userchecks.txt file. This script file only gets processed on incoming messages (the spamrules_localmail.txt script ends the processing of locally sent messages)

IfMatch rcpt /^support$/i
 IfMatch subject /\[[A-Z]{3}-\d{5}\]/
# reference already exists
 Else
  ${Ref} = ""
  Random 65 90 T
  Convert ${T} "Ascii" T
  ${Ref} .= ${T}
  Random 65 90 T
  Convert ${T} "Ascii" T
  ${Ref} .= ${T}
  Random 65 90 T
  Convert ${T} "Ascii" T
  ${Ref} .= "${T}-"
  Random 0 9 T
  ${Ref} .= ${T}
  Random 0 9 T
  ${Ref} .= ${T}
  Random 0 9 T
  ${Ref} .= ${T}
  Random 0 9 T
  ${Ref} .= ${T}
  Random 0 9 T
  ${Ref} .= ${T}
  AddHeader "Subject: [${Ref}] ${Subject}"
 EndIf
EndIf
reference/spamrules_addrandomtexttosubject.txt · Last modified: 2018/11/14 10:45 by 127.0.0.1