File: create.pl

package info (click to toggle)
libimap-admin-perl 1.6.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 164 kB
  • sloc: perl: 809; makefile: 10
file content (21 lines) | stat: -rw-r--r-- 596 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/local/bin/perl

use IMAP::Admin;

if (scalar(@ARGV) < 1) {
	print "usage: $0 mailbox [mailbox ...]
}

$imap = IMAP::Admin->new('Server' => 'my.server.com', 'Login' => 'admin',
			 'Password' => 'adminpass');

foreach $mailbox (@ARGV) {
	$err = $imap->create($mailbox);
	if ($err != 0) {
		print "Error occurred building $mailbox\n\t$imap->{'Error'}\n";
	}
# if you have Cyrus IMAP you could also do lines like these
#	$err = $imap->set_quota($mailbox, 10000);
#	$err = $imap->set_acl($mailbox, 'admin', 'lrswipcda');
# the c and d are the minimum needed to delete mailboxes in cyrus 2.x
}