//////////////////////////////////////////////////////////////////// // file : smtpfilter.wcc // date : 08/23/2002 //
// smtpfilter.wcc is an optional hook for wcSMTP mail filtering. // Wildcat! v5.6.450.3 is required. // // If smptfilter.wcx exist and the registry value EnableReceiverBin
// is enabled, then this wcx will be called after the email is received // and before the final response is sent. The filter can determine
// the final message handling by setting the GlobalResult value. // ////////////////////////////////////////////////////////////////////
#include <htmlutil.wch>
#include <cmdline.wch>
// read name/value data passed by wcSMTP.EXE when the message // is received.
dim args as string = paramstr(1)
dim userid as integer = GetParamInt(args,"uid") // user id, if authenticated dim fname as string = GetParamStr(args,"psf") // message file name
dim rpath as string = GetParamStr(args,"rsp") // router prespool path dim ip as string = GetParamStr(args,"ip") // client ip address
dim helo as string = GetParamStr(args,"cdn") // client domain name dim host as string = GetParamStr(args,"hdn") // host domain name
dim from as string = GetParamStr(args,"from") // sender address dim rcpt as string = GetParamStr(args,"rcpt") // recipient address
WriteLogEntry("smtpfilter.log","---------------------------------------") WriteLogEntry("smtpfilter.log","uid : "+str(userid))
WriteLogEntry("smtpfilter.log","file : "+fname) WriteLogEntry("smtpfilter.log","rpath : "+rpath)
WriteLogEntry("smtpfilter.log","ip : "+ip) WriteLogEntry("smtpfilter.log","helo : "+helo)
WriteLogEntry("smtpfilter.log","host : "+host) WriteLogEntry("smtpfilter.log","from : "+from)
WriteLogEntry("smtpfilter.log","rcpt : "+rcpt)
// Set GlobalResult to finalize the handling of the message file
// GlobalResult Comment
// ------------ ------- // TRUE (-1) pass, message moved to the router prespool for delivery // FALSE (0) fail, 451 response is issued, message discarded // 1 same as TRUE (-1)
// 2 pass, message stays in receiver bin // 3 pass, however, message was moved/deleted by filter
//GlobalResult = 2 // hold message in receiver bin
GlobalResult = TRUE // continue with mail delivery
WriteLogEntry("smtpfilter.log","result: "+str(GlobalResult))
|