[Thamesvalley-pm] calling all Perl newbies!

Greg Matthews gmatt at nerc.ac.uk
Tue Aug 21 07:32:47 PDT 2007


Richard Dawe wrote:
> Have you tried using the Email::* modules? They are a lot simpler to use
> than some of the other modules I've seen. They are part of the Perl
> Email Project (PEP) -- see:
> 
> http://emailproject.perl.org/wiki/Main_Page

I've certainly looked at the PEP site but I must admit I started with 
the Mail::Tools and in particular MIME::Parser

The problem was that the suspect message is tagged as spam and delivered 
to the user as an attachment to a message (which says something like we 
believe the attached message to be spam). The users should then forward 
all of this message as an attachment to particular mailbox. My perl 
script would have to take each individual message in that mailbox, 
explode it and find the original message (and any attachments that had) 
and extract it. I struggled to find a way of identifying the bits of 
message that I needed to extract/discard to end up with something as 
close to the original (pre filtration) message. Using mutt and my 
eyeballs it seems easy - press "v" navigate down to the correct 
attachment and press "s" to save it in mbox format. My brain is doing 
some complicated analysis of the arrangement of attachments to pick out 
the correct one. Turning that into script was what stumped me!

The whole thing is complicated by the fact that our users use a variety 
of mail clients and servers (groupwise, exchange, lotus, outlook, 
thunderbird, opera etc) which each do odd things (apprently opera cannot 
forward a message as an attachment for example, Exchange has the 
annoying habit of stripping almost all headers, and GW is a law unto 
itself).

I'll try it again sometime when I have time and perhaps I'll try the 
PEP-recommended modules. The job of a sysadmin after all, is to automate 
everything!

G



-- 
Greg Matthews           01491 692445
Head of UNIX/Linux, iTSS Wallingford

-- 
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.



More information about the Thamesvalley-pm mailing list