>I'd like to run maildirsmtp as a cron job but only if any outgoing mail
>exists, ie;
>
>       if <any new mail in Maildir> then run maildirsmtp
>
>What's the "best" way to check for new mail in a Maildir?

You could probably get quite fancy by looking at the mtime of the new/ 
directory vs a control file, but that's not easy (or possible?) in a shell 
script.

Another choice is a program that does a readdir() (sans stat() calls).

In the scheme of things:

> Currently I'm thinking of using a script something like this:

> #!/bin/bash
>if [  'ls ~alias/pppdir/new | wc -w' != "" ] ; then
>  # run maildirsmtp here
>fi

Is probably fine. If the directory is huge then this is slowish, but then 
you have a large maildirsmtp process that follows, so who cares? Certainly 
it's pretty cheap for an empty directory.


Regards.

Reply via email to