On Tue, 15 Mar 2005, Moon, John wrote:

> Can someone please give me some suggestions (or pointers) as to how to 
> read and delete emails from a cron job. I will be receiving 
> conformation email and need to process it once then delete it - not 
> process it again.

Is procmail not an option?

This is exactly the sort of thing it's good at.

Procmail sits watching your incoming mail, then handles it in some way. 
This usually means transferring the message to a specific folder, but it 
could also mean running a program that transforms the contents of the 
message (adding or modifying headers, etc), or  doing something else -- 
as, in this case, you're trying to do.

For example, my Procmail rule to run SpamAssassin on incoming mail is:

    :0fw: spamassassin.lock
    | /usr/local/bin/spamc

If I just wanted to filter certain messages, I might do this:

    :0fw: spamassassin.lock
    * ^Subject:.*confirmation
    | /usr/local/bin/spamc

You should be able to adapt this to your needs, and it should be much 
more flexible than using a cron job.

(Note though that setting up Procmail, if it isn't there already, 
requires some overhead. A lot of [Unix] mail servers are already set up 
for it, and all you have to do is enable it for your account, but you'll 
have to sort out what to do if you're starting from scratch. There's a 
lot of good tutorials out there that a Google search will uncover.)



-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to