[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] retrieving email with Perl



>>>Eudora's mailbox files seem to separate its messages with a line that reads
>>>'From ???@???' followed by a date. The next few lines are the various
>>>fields.
>>>It appears that a blank line separates the fields from the body of the
>>>message.

>That seems to be my problem , I can match whatever is between 'From
>???@???' and '\n\n'. In other words the header but I can't seem to match
>from 'From ???@???' to 'From ???@???' which should be the message. My last
>attempt used the flip-flop method
>
>while ('From ???@???'... 'From ???@???'){}

The following code will print just the body of each message. The fields an
be extracted from $headerFields.

David Seay

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

#!perl

  $mailboxFilePath = "Root folder:System Folder:Eudora folder:mailbox name";

  open(FILEDATA, "$mailboxFilePath" || die "Can't open $mailboxFilePath...
$!" );
  my @mailboxLines = <FILEDATA>;
  close(FILEDATA);

  $mailboxLines = join("",@mailboxLines);

  @messages = split(/From \?\?\?\@\?\?\? /,$mailboxLines);

  for $m (1..$#messages) {
    ($headerFields,$body) = split(/\n\n/,$messages[$m],2);
    print "MESSAGE $m -----------------------------\n$body\n\n";
  }


__END__




==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org