use Date::Manip; # Date functions use Mail::Internet; # parse incoming headers use Config::Simple; # read thing=otherthing values # For randomizing filenames use Digest::MD5 qw(md5 md5_hex md5_base64); my $date = UnixDate("today","%b %e, %Y at %T"); my $md5file = md5_hex($date); my $workpath = "/tmp"; my $message = new Mail::Internet ([<>]); my $from = $message->get('From'); my $subject = $message->get('Subject'); my @body = @{$message->body()}; # Config::Simple requires a file, so we create # a temporary scratch file here, and write the # contents of @body to it for storage open(INFILE, ">$workpath/$md5file.msg") or die "$!"; print INFILE @body; close ('INFILE'); my $cfg = newConfig::Simple( filename => "$workpath/$md5file.msg"); my $template = $cfg->param(-block=>'template'); $url = $template->{url}; $bpp = $template->{bpp}; $maxdepth = $template->{maxdepth}; $compression = $template->{compression}; $filename = $template->{filename}; $title = $template->{title}; unlink "$workdir/$md5file.msg";