in reply to Mail::Audit and time sensitivity

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...

  1. 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
  2. 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.