1 | <?php |
---|
2 | /* |
---|
3 | $Id: mail_doaddmodified2.php 1010 2006-02-27 04:46:35Z root $ |
---|
4 | ---------------------------------------------------------------------- |
---|
5 | AlternC - Web Hosting System |
---|
6 | Copyright (C) 2002 by the AlternC Development Team. |
---|
7 | http://alternc.org/ |
---|
8 | ---------------------------------------------------------------------- |
---|
9 | Based on: |
---|
10 | Valentin Lacambre's web hosting softwares: http://altern.org/ |
---|
11 | ---------------------------------------------------------------------- |
---|
12 | LICENSE |
---|
13 | |
---|
14 | This program is free software; you can redistribute it and/or |
---|
15 | modify it under the terms of the GNU General Public License (GPL) |
---|
16 | as published by the Free Software Foundation; either version 2 |
---|
17 | of the License, or (at your option) any later version. |
---|
18 | |
---|
19 | This program is distributed in the hope that it will be useful, |
---|
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
22 | GNU General Public License for more details. |
---|
23 | |
---|
24 | To read the license please visit http://www.gnu.org/copyleft/gpl.html |
---|
25 | ---------------------------------------------------------------------- |
---|
26 | Original Author of file: Benjamin Sonntag |
---|
27 | Purpose of file: Create a new mail account |
---|
28 | ---------------------------------------------------------------------- |
---|
29 | */ |
---|
30 | |
---|
31 | require_once("../class/config.php"); |
---|
32 | |
---|
33 | /* ----------------------------------------------------------------- */ |
---|
34 | /** The usr_list is the file that has the list of mails to be created. |
---|
35 | * It must have the following format in order to work correctly. |
---|
36 | * To create mailboxes: |
---|
37 | * domain left_side_of_the_mail 1 (1 if pop) password |
---|
38 | * here is a example: |
---|
39 | * ---------------------------- |
---|
40 | * alterc.org tech 1 goalternc |
---|
41 | * ---------------------------- |
---|
42 | * To create alias: |
---|
43 | * domain left_side_of_the_mail 0 (for alias) * (to skip the password) redirection |
---|
44 | * ---------------------------- |
---|
45 | * alterc.org techs 0 * tech@alternc.org |
---|
46 | * ---------------------------- |
---|
47 | * NB: there can only be one redirection per alias. |
---|
48 | */ |
---|
49 | |
---|
50 | $fileinfo = fopen("/var/alternc/import-data/usr_list", "r"); |
---|
51 | |
---|
52 | |
---|
53 | # Read data from fileinfo into all the variables |
---|
54 | while ($data = fscanf($fileinfo, "%s\t%s\t%d\t%s\t%s\n")) { |
---|
55 | |
---|
56 | require_once("/var/alternc/bureau/class/config_nochk.php"); |
---|
57 | list ($domain, $email, $pop, $pass, $alias) = $data; |
---|
58 | |
---|
59 | #now print for viewing: |
---|
60 | echo ("Domain: $domain\n"); |
---|
61 | echo ("Mail: $email\n"); |
---|
62 | |
---|
63 | if ($pop=="1"){ |
---|
64 | echo ("Password: ****\n"); |
---|
65 | echo ("Type : mailbox\n"); |
---|
66 | } |
---|
67 | else if ($pop=="0") { |
---|
68 | echo ("Type: alias to $alias\n"); |
---|
69 | } |
---|
70 | else { |
---|
71 | echo ("<p class=\"error\">ERROR : check your source file.</p>"); |
---|
72 | } |
---|
73 | |
---|
74 | if (!$mail->add_mail($domain,$email,$pop,$pass,$alias)) { |
---|
75 | $error=$err->errstr(); |
---|
76 | $addok=0; |
---|
77 | echo "<blockquote><p class=\"error\">$error</p></blockquote>"; |
---|
78 | } |
---|
79 | |
---|
80 | else { |
---|
81 | $addok=1; |
---|
82 | echo "<blockquote>The mailbox $email@$domain has been successfully created </blockquote>"; |
---|
83 | } |
---|
84 | |
---|
85 | } |
---|
86 | fclose($fileinfo); |
---|
87 | $error=0; |
---|
88 | require_once("mail_list.php"); |
---|
89 | |
---|
90 | exit(); |
---|
91 | ?> |
---|