Sendmail puzzle - Round Robin Delivery

I have a client that takes email orders for his services.  He wants one email addy setup for all orders, but wants the orders from that addy forwarded to a group of order entry people round robin style.  The idea is if he has 10 order entry people, and he get 1000 orders per day, that each person would get a balanced number of orders to enter.  Is there a script or an
entry I can use (maybe utilizing procmailrc) that will accomplish this?
Who is Participating?
No way to do this in a stock sendmail environment. Each address resolution occurs independent of the ones before or after.

I imagine you could do this with ProcMail running on the machine where local delivery is happening, using a system-wide ProcMail script. I haven't the faintest idea how you'd code it - seems to me you need some sort of persistent information store to track who got the last one and who should get the next one.

I think it'd be easier to do something like this in the framework provided by MIMEDefang ( Using MIMEDefang, you can examine and alter virtually any aspect of an E-Mail. Since it's implemented in Perl, you can make use of Perl's file IO and database interfaces to create the persistent data store. As a bonus, MIMEDefang offers some excellent anti-SPAM capabilities.
Have I understood that all oders will be send be customers to one "externally visible" email address?

You can create OS account,  use ~/.procmailrc to deliver "round robin forwarding".

It would require using "per recipe" locking in procmail script and simple (perl?) script for keeping "in file round robin counter" and selecting recipient address from the list based on the counter value.
[ 10-20 lines of perl, 30 minutes  to gamma version]

Such design should be sufficient for handling on average 1 order every ~30s per 8h working day.
OK, anfi has given you a method to do it with ProcMail.

I'll note that MIMEDefang offers a great deal more capability, including the ability to rewrite headers (or even content) for OUTbound messages, so that even when  the salespeople screw up their mail reader/composer configuration, the "Reply-to" and other headers will indicate a standard reply address. This might be helpful.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.