If you want to go OO you can use Mail::Internet

However, if you're just wanting to put mail into a Mhonarc archive, here's some code I use to do that:

my $mhonarc = "/usr/local/bin/mhonarc"; # Path to Mhonarc executable my $archive = "/home/httpd/html/archive"; # Path to archive my $rcfile = "/home/httpd/mhonarc.rc"; # Path to Mhonarc rcfile my ($m,$y) = (localtime(time))[4,5]; $m++; $y+=1900; my $month = sprintf("%04d%02d", $y, $m); # make a directory name like +YYYYMM unless (-e "$archive/$month") { mkdir("$archive/$month", 0775) || die "Couldn't make new archive dir: $!\n"; } open(OUT, "|$mhonarc -add -rcfile $rcfile -outdir $archive/$month -qui +et") || die "Couldn't open mhonarc: $!\n"; while(<STDIN>) { print OUT; } close (OUT);
Make sure the mail daemon has permission to run this script, and that it has permission to create subdirectories in your archive directory.

In reply to Re: give perl an email by httptech
in thread give perl an email by skazat

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, details, 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, summary, 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.