Custom handling of complaint mails

Users can override the default behavior of the complaint handlers. If the appropriate entry is added to the tclCustom.tcl file which is sourced by Aurea List Manager on startup if the file exists in Tcl library directory (tclweb\lib\lm on Windows, tclweb/lib/lm under Linux), a new process for handling complaint mails can be created. You may wish to create a replacement or additional process for complaint handling, to take care of tasks like unsubscribing the complainer on all lists on the server (or site), writing complainers to an external table, etc.

To make sure that the custom handler is used, here is how to set up the autoresponder:

Go to Utilities > Automated Messages > Autoresponders

Click Create New Autoresponder.

3) On the Essentials Tab, create an Email address prefix for your complaint handler (For example, abuse).

On the Advanced Tab, select Complaints for the Special Mail Handling dropdown, and your complaint handler (For example, NewComplaintHandler using the example below) for the Run Tcl Extension dropdown.

5) Click the Save button to put the new handler into production.

Here's an example of what the tclCustom.tcl file should look like:

#########################################################################
#
# file tclCustom.tcl
#
# establish the special handler Tcl namespaces

namespace eval ::tclextensions:: {}

namespace eval ::tclextensions::autoresponder:: {}


# Any procedure that starts with ::tclextensions::autoresponder:: will show up in the "Run Tcl Extension" dropdown
# but the name must NOT start with _extract

# Arguments
#
# MemberID - the MemberID_ value of the user from the members_ table
# MailingID - the MessageID_ value of the incoming message in the inmail_ table
# ListID - the ListID_ value from the lists_ table that the complaining member is on
# ComplaintMessageID - the MessageID_ value from the outmail_ table for the posting that the user is complaining about
# UserNameLC - the local name (part to the left of the @ in the email address) for the complaining user
# Domain - the ISP/domain name part of the email address of the complaining user
# RcptTo - the destination address that the complaint was sent to (which is the auto-responder's email address)
#
# Return value
# 0 - This extension replaces the default complaint processing
# 1 - This extension is used in conjunction with the default complaint process (but precedes it)
#
proc ::tclextensions::autoresponder::NewComplaintHandler {MemberID MailingID ListID ComplaintMessageID UserNameLC Domain RcptTo} {

# Write the complaining user out to a file

set fd [open "C:\\complaints.txt" a]
if {$fd == ""} {
# can't open file, just continue processing
return 1
}

set callinfo "MemberID - $MemberID\nMailingID - $MailingID\nListID - $ListID\nComplaintMessageID - $ComplaintMessageID
UserNameLC - $UserNameLC\nDomain - $Domain\nRcptTo - $RcptTo\n"

# write parameters out to the file, catch and ignore errors
catch {puts $fd $callinfo}
catch {close $fd}

# allow default processing to occur
return 1

}