Mail: Scripted Filter?

I need to create a script that filters the subject line of incoming emails.

Long story short: I work in graphics production. the sales staff sends in copy/graphics/layouts to my department and we create the final product. the problem is that the sales staff doesn’t bother filling out the subject line of these emails and we spend most of our time searching through emails (pia)

i would like to create a script that runs in the background.

this script would have a data base of email addresses

if someone from the data base sends an email the subject line must contain an 7 digit number.

if it does not contain an 7 digit number the email is refused and returned to sender

—i don’t know if mail has return to sender function…i guess it could do an auto reply with a statement saying the “email has been returned” and the original email could auto delete)

— 7 digit number could be any 7 digit number. once a sale has been entered into the front end system it generates an order with an 7 digit number - that is the number the sales staff should be using in the subject line to identify their specific material for any given client. i guess the script should recognize and refuse any consecutive numbers ex: 0000000, 1111111 or number series such as 1234567

anyone have any ideas?? not sure how to even start such a script??

thank you in advance r260