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.
I think you are missunderstanding the intent of this example, and perhaps the purpose of Mail::Audit.
This module is designed to make it very easy for you to write very complicated real-time mail filters in perl. Or to put it another way: It's not intended for writting scritps that run once (or once every X seconds) and process mail in a specified folder, It's intended to process your mail in real time as it is being delivered to you.
In Simon's example, there is no "sensitivity" of "btw 9am-6pm" .. what he is doing, is saying that if the current time (that the script is being executed) is durring work hours, then forward the message to his work account. The reason he is looking at the current time, is becuase he knows that his program will be executed at the moment the mail has arrived.
Quite simply, I think you need to do one of two things...
- Don't use Mail::Audit. If your true goal is to write a script that checks for mail that you have recently placed in a "toForward" then you probably want to write yourself a script that uses something like Mail::Box to open a mail box, read the messages, forward them and delete them; and then run it using a cron job
- Don't worry about trying to do something every 5 seconds, don't worry about putting mail in a "toForward" folder, find some propety of all the message you recieve that you want to use as a criteria to forward them, and then write a Mail::Audit script that uses that criteria, then make sure you read the Mail::Audit FAQ to see how to get your script to run everytime you get a new email.
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.