[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


Folks,

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

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

        :0 b :
        |~/bin/xmldumper.pl
}

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";
}

etc....  
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,
0.3K]
  I     2 trail-mail.xml                   [text/xml, quoted, iso-8859-1,
1.9K]

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
Andrew


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;
        boundary="----=_Part_1981_13090907.1046691598405"
Status: RO
Content-Length: 2692
Lines: 83

------=_Part_1981_13090907.1046691598405
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

------=_Part_1981_13090907.1046691598405
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">
<trail-mail><asset-type>vessel</asset-type>
<asset-code>OYTALBAV</asset-code>
<asset-name>Alba Venturer</asset-name>
<date-time><year>2003</year>
<month>03</month>
<day>03</day>
<hour>11</hour>
<minute>39</minute>
<second>00</second>
<offset>0</offset>
</date-time>
<position><latitude><degrees>55</degrees>
<minutes>55</minutes>
<seconds>33.6</seconds>
<hemisphere>north</hemisphere>
</latitude>
<longitude><degrees>4</degrees>
<minutes>53</minutes>
<seconds>9.6</seconds>
<hemisphere>west</hemisphere>
</longitude>
</position>
</average-speed>
</trail-mail>

------=_Part_1981_13090907.1046691598405--