Hey perl monks,
I was wondering if anyone could give me an example of how to forward mail from a folder every 5 seconds using Mail::Audit? Something along the lines of
#! /usr/bin/perl;
use Mail::Audit;
my $folder = "/home/me/mail/toForward";
my $item = Mail::Audit->new;
my $subject = $item->subject();
my ($hour, $wday) = (localtime)[2,6];
if ($wday !=0 and $wday !=6 # Not Saturday/Sunday
and $hour > 9 and $hour < 18) { # Between 9am and 6pm
$item->resend('archive@theoffice.com');
# resend is the only action
# which doesn't end the program.
}
I used this example from Simon Cozen's tutorial, but I'm not sure how to change the time sensitivity to every 5 seconds instead of btw 9am-6pm. Also, I'm not sure if this will only fwd mail from the toForward folder. Any advice is welcome.
thanks.
jc
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.