source: trunk/doc-expressolivre/suse/arqs-conf-suse/cyrus.pl @ 67

Revision 67, 1.1 KB checked in by niltonneto, 13 years ago (diff)

* empty log message *

  • Property svn:executable set to *
  • Property svn:mime-type set to application/octet-stream
Line 
1#!/usr/bin/perl -w
2
3# Author: <joao.alfredo@gmail.com>
4
5use Cyrus::IMAP::Admin;
6
7#
8# CONFIGURATION PARAMS
9#
10my $cyrus_server = "localhost";
11my $cyrus_user = "expresso-admin";
12my $user = "expresso-admin";
13my $mechanism = "login";
14
15if (!$ARGV[0]) {
16        die "Usage: $0 [expresso-admin password]\n";
17} else {
18        $cyrus_pass = "$ARGV[0]";
19}
20
21print "Criando usuario: $user. \n";
22createMailbox($user,'INBOX');
23createMailbox($user,'Enviados');
24createMailbox($user,'Lixeira');
25createMailbox($user,'Rascunhos');
26sub createMailbox {
27
28        my ($user, $subfolder) = @_;
29
30        my $cyrus = Cyrus::IMAP::Admin->new($cyrus_server);
31        $cyrus->authenticate($mechanism,'imap','',$cyrus_user,'0','10000',$cyrus_pass);
32
33        if ($subfolder eq "INBOX") {
34                $mailbox = "user.". $user;
35        } else {
36
37# Na linha abaixo, o valor entre " é o delimitador do imap. Geralmente "." ou "/".
38
39                $mailbox = "user.". $user .".". $subfolder;
40        }
41
42        $cyrus->create($mailbox);
43        if ($cyrus->error) {
44                print STDERR "Error: ", $mailbox," ", $cyrus->error, "\n";
45        } else {
46                print "Mailbox $mailbox criada com êxito.\n";
47        }
48
49}
Note: See TracBrowser for help on using the repository browser.