[Scottish] procmail passing a certain attachment onto a program

Elwell, AD (Andrew) scottish at mailman.lug.org.uk
Tue Mar 4 19:48:04 2003


I have a wee procmail/perl problem - I used to have a recipie that matched
XML mails as follows..

# boat tracking
* ^From.technical@purplefinder.com
* ^TO_xml@oytscotland.org.uk
        :0 c

        :0 b :

which seemed to work OK - the xmldumper script took in the xml body and...

#!/usr/bin/perl -w
my $debug = 1;
use XML::Simple;
my $file = "-";
my $mail = XMLin($file);

if ($debug) {
  use Data::Dumper;
  print Dumper($mail);
  print "==============================\n";

did much munging and parsing and updating various websites and databases.
all good stuff.

However Purplefinder "improved" the service and now send multipart messages.

  I     1 <no description>               [text/plain, quoted, iso-8859-1,
  I     2 trail-mail.xml                   [text/xml, quoted, iso-8859-1,

is there a way of getting procmail to only pass on the text/xml part to the
program pipe?
I enclose a snipped sample of the mails incase it helps (oh, and they also
altered the "from" address - but I nailed that one easily)

Many thanks

Message-ID: <23408519.1046691598622.JavaMail.root@crossbow>
From: trail-mail@purplefinder.com
To: xml@oytscotland.org.uk
Subject: Trail from Alba Venturer
Mime-Version: 1.0
Content-Type: multipart/mixed;
Status: RO
Content-Length: 2692
Lines: 83

Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Asset name: Alba Venturer
Asset posting: 0600,1200,1800,0000
Mailto: vessel.OYTALBAV@purplefinder.com
Communicator key: inmarsatc.423590219:12101
Date & time: 2003-03-03 11:39:00
Position: 55=B055'33.60"N 4=B053'09.60"W
Speed: 7.6 knots
Average speed: 3.14 knots
Heading: 1 degrees
Proximity: Dunoon

Content-Type: text/xml; name=trail-mail.xml; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="trail-mail.xml"

<?xml version=3D"1.0" encoding=3D"ISO-8859-1"?>
<!DOCTYPE trail-mail SYSTEM "http://www.purplefinder.com/trail-mail.dtd">
<asset-name>Alba Venturer</asset-name>