Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Module to parse e-mail messages? 2

Status
Not open for further replies.

TonyGroves

Programmer
Aug 13, 2003
2,389
IE
I need to write a utility which includes parsing an e-mail message into its constituent parts, ending up with the text body and the attachments (all decoded).

I thought CPAN might have such a module, but I can't find anything obvious there. Does anybody know if there is such a module available?

Alternatively, if anybody knows of a Linux script that can do an equivalent job, that would be great.

Thanks a lot.
 
Solved, I think!

I eventually found MIME::parser, which looks like it should do the job. Sorry for posting in haste!
 
Hi Tony I'm trying to do the same thing but having real problems!!! Did you complete this successfully? Any chance I could have a look at your code?

Thanks!
 
Here's my code. It splits a message into individual files in $tempdir.
[tt]
use MIME::parser;
my $parser=new MIME::parser;
`mkdir -p $tempdir`;
$parser->output_dir($tempdir);
writelog"Parsing message";
if(!$parser->parse_data($msg))
{writelog"Couldn't parse message - aborting!";exit __LINE__;}
[/tt]
 
woohoo!!!!

Thanks Tony! Once I managed to get the Parser module installed properly your piece of code works perfectly!!!

Thankyou!
 
WTG Tony!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top