Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Here is what I'm currently toying with - it's by no means complete and tested out, but it takes messages from my POP3 server, and stuffs them into a local maildir directory - the "local maildir" part would have to be implemented by you, as you wouldn't store your messages in one of the formats provided by Mail::Box :

#!/usr/bin/perl -w # Some vestige of local delivery # For another method, have a look at Mail::LocalDelivery use strict; use Net::POP3; use Mail::Box; use Mail::Box::Manager; use Mail::Message; use Mail::Message::Construct; # Use ~/.netrc to determine pop3 login and password use vars qw($host $localmailbase $foldername); use vars qw($pop3); use vars qw($mgr $folder); $host = 'hera.informatik.uni-frankfurt.de'; $localmailbase = "/home/corion/mail/"; $foldername = "informatik"; $mgr = Mail::Box::Manager->new(folderdir => $localmailbase, default_folder_type => 'maildir', ); $folder = $mgr->open( folder => $foldername, access => 'rw', create => + 1 ); die "Couldn't open mailfolder '$foldername' : $!\n" unless $folder; print "Using folder ",$folder->name,"\n"; my %messageIDs; %messageIDs = map { $_->get("Message-ID"), $_ } ($folder->messages); $pop3 = Net::POP3->new($host); my $total = $pop3->login; die "Error logging into $host" unless defined $total; # No news is good news exit unless $total > 0; my $firstunread = $pop3->last() +1; for my $message ($firstunread..$total) { print "Message $message\n"; my $message_lines = $pop3->get($message); #local *F; #open F, "< inmail" or die "Couldn't read test message 'inmail' : $! +\n"; #my $message_store = Mail::Message->read(\*F); my $message_store = Mail::Message->read($message_lines); if ($message_store) { if (defined $messageIDs{$message_store->get("Message-ID")}) { print "Duplicate, rejected ",$message_store->get("subject"),"\n" +; } else { print "Subject:",$message_store->get("subject"),"\n"; $folder->addMessage( $message_store ); }; }; #close F; }; die "Couldn't save '$foldername' : $!\n" unless $folder = $folder->wri +te(); $mgr->close($folder);
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

In reply to Re: Re: Re: Parse Email by Corion
in thread Parse Email by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (10)
    As of 2020-04-01 14:50 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      The most amusing oxymoron is:
















      Results (17 votes). Check out past polls.

      Notices?