Creating a mailbox is -obviously- required each time you want to add an user to your CyrusImapd server. This can be done with the Cyradm utility, but it is a lot easier to use a script for that, especially when you want to create a lot of mailboxes at a time.

There is a sourceforge project which has some tools related to CyrusImapd, located at http://sourceforge.net/projects/cyrus-utils, and one of these tools is a perl script (imapcreate.pl) which can be used to create mailboxes. For now, this project seems dead. No update in 2 years. But the scripts work. As I haven't received any response when I posted bugfixes or new features, I maintain an enhanced version which can be found at http://clement.hermann.free.fr/scripts/Cyrus/imapcreate.pl (it's also attached here).

New features:

  • Uses the "strict" pragma
  • An option to specify a mailbox name (or a comma-separated list) was added (you can still use the standard input)
  • The unix hierarchy separator is now supported
  • You can now specify quota in Mb or Gb m,M, and g,G suffix (not only kilobytes)
  • You can delete mailbox instead of creating them
  • There is now a verbose mode

Launching the script without any parameters will show a short help. It should be pretty self-explanatory.

Here are some examples on how the script could be invoked:

this will read the file list.txt, and create the mailboxes listed in it with a 50MB quota:

cat list.txt | ./imapcreate.pl -u cyradm -p 'cyruspass' -q 50M mail.example.com

this will create a mailbox for john, using the Unix Hierarchy separator, no quota, in verbose mode:

./imapcreate.pl -u cyradm -m john -s -v mail.example.com

the output would look like this:

Creating user.john on default

This script is far from being perfect, but it works great for me. feel free to e-mail me about it, to report bugs, to send patches etc: clement.hermann@free.fr

Note for the paranoids (as you should be) :

You should verify the script content before using it. This is a wiki. Anyone can modify this file. This script is neither long nor difficult to understand, so don't hesitate, be paranoid. You can also download it from http://clement.hermann.free.fr/scripts/Cyrus/imapcreate.pl : This should be more secure as I am (hopefully) the only person who can upload anything there.

Yeah, I know, I should really sign that script with PGP. Maybe on next update.

-- ClementHermann? - nodens - 29 Nov 2003

Topic attachments
I Attachment Action Size Date Who Comment
plpl imapcreate.pl manage 5.1 K 21 Apr 2005 - 09:55 TWikiGuest The imapcreate.pl script.
Topic revision: r46 - 31 Aug 2005 - 13:25:49 - TWikiGuest
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback