Hi, 
Im new (here|to perl) and would like to start of with that:

My script should replace attachmends in mails: however, i cant find any atts.

Script first:
 ------
#! /usr/bin/perl

use strict;
use warnings;
use Mail::POP3Client;
use Mail::Audit qw(Attach);

my $pop=new Mail::POP3Client(USER => "you",
                          PASSWORD => "youpass",
                          HOST => "your.server");

for (my $i=1; $i<= $pop->Count();$i++) {
   my @mail = $pop->Retrieve($i);
   my $mailref = [EMAIL PROTECTED];
   my $mail = Mail::Audit->new(data => $mailref);       
   print "From: ", $mail->from,"\nSubject: ",$mail->subject, "\n";

#try to find Content-type: multipart/mixed; boundary=.... in mail header 
#manually
   foreach (@$mailref){ 
     /^(Content-type:)\s+/i and print "$_\n";
   }

#let Mail::Audit:Attachments try
   print "Att-no: ", $mail->num_attachments, "\n";
   my $atts = $mail->attachments;
   foreach (@$atts){
     print "size: ",$_->size,"\nfilename: ",$_->filename,"\n";
   }


} #for all mails in inbox

$pop->Close();

---------------------------

Since I dont want the Mail::Audit object to use my local inbox but the pop 
retrieved data I pass the array ref to it.

The problem:
even though a print join ("\n",[EMAIL PROTECTED]); shows me there are "Content-type: 
multipart\mixed...." headers my first attempt to find them manually fails and 
gives me only the "Content-type: text/plain" or "..application/blabla" lines 
from the mail body of multi part mails.

Second attempt to identify atts via Mail::Audit::Attachment fails too.

All mail headers of the retrieved messages do carry a "MIME-version: 1.0" line 
as required by Mail::Audit::Attachment.

All the other print froms and so work fine 

What am I doing wrong?
Better solutions?

Thanks a lot, Wolf


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to