From: "Stuart J. Browne" <stuart@promed.com.au> Subject: Re: Decoding emails Date: Thu, 3 Oct 2002 15:34:39 +1000 References: <vqilpuo435ht0n9g0bs288en14e8ihod7t@4ax.com>
<anftml$1bs$1@perki.connect.com.au> "Stuart J. Browne" <stuart@promed.com.au> wrote in message news:anftml$1bs$1@perki.connect.com.au... > "Iain Sharp" <iains@pciltd.co.uk> wrote in message > news:vqilpuo435ht0n9g0bs288en14e8ihod7t@4ax.com... > > > > We have a need for a script/program to parse an email file under SCO > > and strip out and decode all the base64 encoded files contained in it. > > > > Does anyone know of such a utility. > > > > SCO 5.0.4 to 5.0.6, standard file format in /usr/spool/mail/xxxx > > having been put in there by sendmail. > > > > Better yet if the files can be decoded automatically as part of the > > sendmail routing, but I've not had any success with the posted methods > > of running sendmail to output via a script. > > You might want to look into thigns like 'mimedecode' (or 'mdecode'). I > don't they are distributed as part of the SCO OS' by default, but they > should be available as part of Skunkware. > > Failing them, look at 'mutt'. ... for the record, what we do is use uuencode, and a filter similar to:
---------------------------------------------------------------
#!/usr/bin/perl
$Export_Directory = "/usr/spool/uucppublic";
$File_Begin = 0;
while (<STDIN>) {
if (/^begin [0-7](?:[0-7]{2})? ([[:alnum:]\._-]+)/) {
$File_Begin = 1;
open( FILEHANDLE, "> $Export_Directory/$1");
}
if ($File_Begin) {
print FILEHANDLE unpack("u*", $_ );
if (/^end/) {
close( FILEHANDLE );
$File_Begin = 0;
}
}
}
---------------------------------------------------------------
set up as an alias (filedump: "| /usr/local/bin/filedump.filter") using sendmail. Anything sent uuencoded to that address gets decoded automatically and dumped.. But if you're receiving Mime messages, you'd have to make this sort of routine more complex in order to grab out the file name from the MIME header etc. etc. bkx
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar