To install:
- You'll need Perl running on the Mailtraq machine. I've been using 5.6.1 from http://www.activestate.com. Update the machines 'path' environment var to include the perl executables' location, if not already set. The default installation includes the Perl Package Manager (PPM) and quite a few of the modules needed to run the script.
- Install the following perl modules. To use the PPM enter "PPM" from the command line, then run the six commands:
- Code: Select all
ppm> install MIME-tools
ppm> install TNEF-Convert
ppm> install MIME-Types
ppm> install Getopt-Long
ppm> install http://www.roth.net/perl/packages/win32-daemon.ppd
ppm> install http://www.roth.net/perl/packages/win32-perms.ppd
- Set the Mailtraq Message Filter registry locations. Shut down Mailtraq and update this registry key:
- Code: Select all
LocalMachine/Software/Fastraq/Mailtraq/MessageFilters/TnefDecode
The key must contain 'InQueue' and 'OutQueue' string values with the full path to the input and output directories, e.g:- Code: Select all
InQueue="C:\Mailtraq\database\TnefDecode\In"
OutQueue="C:\Mailtraq\database\TnefDecode\Out"
- Install the script as a Win32 service. Copy the script to, say, C:\Mailtraq\database\TnefDecode\ then install the service from the command line with the following parameters:
- Code: Select all
perl tnefdecode.pl -install -a -hdrs -m
When first run you'll see messages about some working directories being created (these exist at the same level as 'InQueue').
-a writes ".activate", a zero-byte file to InQueue at every service start-up. This ensures that Mailtraq uses the Message Filter - without it, Mailtraq will ignore the filter and process normally.
-hdrs will delete any MS-TNEF-Correlator header and add an X-Perl-TnefDecode header to any messages that have been decoded. The latter is also used to show any unsuccessful attempts at mime decoding.
-m will output a file to the OutQueue on TNEF decoding so that Mailtraq's log file includes entries like these:- Code: Select all
00010000 00000000 [timestamp] MessageFilter: TnefDecode {filename} {n} TNEF attachments decoded
00000800 00000000 [timestamp] MessageFilter: TnefDecode {filename} can't decode mime structure
-f is used to change the InQueue polling frequency from the default 2 seconds.
-l allows you to change the log file location (it lives above InQueue by default).
-remove will uninstall the win32 service.
More information is available at the command line - run the script with "-h" for 'help' (perl tnefdecode.pl -h). - Start the TnefDecode service.
From the command line run 'net start tnefdecode' or you can 'Start/Stop/Pause/Resume' from the windows Service Control Manager.
When the service starts it should create a log file which records service events and conversion activity (successes and failures). If the script finds a message with mime that it can't handle, a copy will be stored in an "unparsable-mime" directory (located at the same level as InQueue) before it's passed to OutQueue. I've been running for a good few months and I've only found 1 so far (a message containing an attachment with a Hungarian file name).
Cheers, Martin