Batch mailbox creation

Anthony Tibbs anthony-list at
Thu Sep 7 08:23:55 EDT 2006

This isn't thoroughly tested or anything, but you could use something like 
the following to generate a "command list" to be fed to cyradm, no?

It doesn't check for things like the user already having a Spam mailboox, 
but... that wouldn't be hard to add.  Is "-c" appropriate to prevent mailbox 
deletions by the user?

--- snip ~/mkmailboxes ---
pushd /var/spool/imap/domain >/dev/nul
for domLtr in *; do
   pushd $domLtr >/dev/nul
   for domain in *; do
      pushd $domain >/dev/nul

      for usrltr in *; do
         pushd $usrltr/user >/dev/nul
         for email in *; do
            echo cm user.$email@$domain.Spam
            echo sam user.$email@$domain.Spam cyrus a
            echo sam user.$email@$domain.Spam anyone p
            echo sam user.$email@$domain.Spam $email@$domain -c
            echo -n "\n"
         popd >/dev/nul

      popd >/dev/nul
   popd >/dev/nul
popd >/dev/nul
--- Snip ---

More information about the Info-cyrus mailing list