extmail.sql脚本:
- /*
- ExtMail - OSS
- by He zhiqiang <[email protected]>
- Copyright (c) 1998-2005 hzqbbc.com
- License: GPL v2
- This is the MySQL database structure for ExtMail System, derive from
- Postfixadmin ( http://high5.net/howto/ ) project, and modify to meet
- our need, it is compatible with PostfixAdmin MySQL structure and have
- some extmail specific attributes and structure
- ExtMail have an alternative solution on openLDAP, please check the
- extmail.schema (V3) for detail.
- You can create the database from the shell with:
- mysql -u root [-p] < extmail.sql
- */
- /*
- Initialize mysql
- */
- USE mysql;
- /* readonly user & password */
- /* clean user if exists */
- delete FROM user where User in ('extmail','webman');
- delete FROM db where User in ('extmail','webman');
- INSERT INTO user (Host, User, Password) VALUES ('localhost','extmail',password('extmail'));
- INSERT INTO db (Host, Db, User, Select_priv) VALUES ('localhost','extmail','extmail','Y');
- /* extman read/write user & password */
- INSERT INTO user (Host, User, Password) VALUES ('localhost','webman',password('webman'));
- INSERT INTO db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv) VALUES ('localhost', 'extmail', 'webman', 'Y', 'Y', 'Y', 'Y');
- FLUSH PRIVILEGES;
- /* readonly user */
- GRANT USAGE ON extmail.* TO extmail@localhost;
- GRANT SELECT, UPDATE ON extmail.* TO extmail@localhost;
- /* read/write user */
- GRANT USAGE ON extmail.* TO webman@localhost;
- GRANT SELECT, INSERT, DELETE, UPDATE ON extmail.* TO webman@localhost;
- CREATE DATABASE extmail;
- USE extmail;
- /* Table structure for table manager */
- CREATE TABLE manager (
- username varchar(255) NOT NULL default '',
- password varchar(255) NOT NULL default '',
- type varchar(64) NOT NULL default 'postmaster',
- uid varchar(255) NOT NULL default '',
- name varchar(255) NOT NULL default '',
- question text NOT NULL default '',
- answer text NOT NULL default '',
- disablepwdchange smallint(1),
- createdate datetime NOT NULL default '0000-00-00 00:00:00',
- expiredate DATE NOT NULL default '0000-00-00',
- active tinyint(1) NOT NULL default '1',
- PRIMARY KEY (username),
- KEY username (username)
- ) TYPE=MyISAM COMMENT='Ext/Webman - Admin Accounts';
- /* Table structure for table alias */
- CREATE TABLE alias (
- address varchar(255) NOT NULL default '',
- goto text NOT NULL,
- domain varchar(255) NOT NULL default '',
- createdate datetime NOT NULL default '0000-00-00 00:00:00',
- active tinyint(1) NOT NULL default '1',
- PRIMARY KEY (address),
- KEY address (address)
- ) TYPE=MyISAM COMMENT='ExtMail - Virtual Aliases';
- /* Table structure for table domain */
- CREATE TABLE domain (
- domain varchar(255) NOT NULL default '',
- description varchar(255) NOT NULL default '',
- hashdirpath varchar(255) NOT NULL default '',
- maxalias int(10) NOT NULL default '0',
- maxusers int(10) NOT NULL default '0',
- maxquota varchar(16) NOT NULL default '0',
- maxnetdiskquota varchar(16) NOT NULL default '0',
- transport varchar(255) default NULL,
- can_signup tinyint(1) NOT NULL default '0',
- default_quota varchar(255) default NULL,
- default_netdiskquota varchar(255) default NULL,
- default_expire varchar(12) default NULL,
- disablesmtpd smallint(1),
- disablesmtp smallint(1),
- disablewebmail smallint(1),
- disablenetdisk smallint(1),
- disableimap smallint(1),
- disablepop3 smallint(1),
- createdate datetime NOT NULL default '0000-00-00 00:00:00',
- expiredate DATE NOT NULL default '0000-00-00',
- active tinyint(1) NOT NULL default '1',
- PRIMARY KEY (domain),
- KEY domain (domain)
- ) TYPE=MyISAM COMMENT='ExtMail - Virtual Domains';
- /* Table structure for table domain_manager */
- CREATE TABLE domain_manager (
- username varchar(255) NOT NULL default '',
- domain varchar(255) NOT NULL default '',
- createdate datetime NOT NULL default '0000-00-00 00:00:00',
- active tinyint(1) NOT NULL default '1',
- KEY username (username)
- ) TYPE=MyISAM COMMENT='Ext/Webman - Domain Admins';
- /*
- Table structure for table mailbox
- mapping: name <-> cn, username <-> mail
- */
- CREATE TABLE mailbox (
- username varchar(255) NOT NULL default '',
- uid varchar(255) NOT NULL default '',
- password varchar(255) NOT NULL default '',
- clearpwd varchar(128) NOT NULL default '',
- name varchar(255) NOT NULL default '',
- mailhost varchar(255) NOT NULL default '',
- maildir varchar(255) NOT NULL default '',
- homedir varchar(255) NOT NULL default '',
- quota varchar(16) NOT NULL default '0',
- netdiskquota varchar(16) NOT NULL default '0',
- domain varchar(255) NOT NULL default '',
- uidnumber int(6) NOT NULL default '1000',
- gidnumber int(6) NOT NULL default '1000',
- createdate datetime NOT NULL default '0000-00-00 00:00:00',
- expiredate DATE NOT NULL default '0000-00-00',
- active smallint(1) NOT NULL default '1',
- disablepwdchange smallint(1),
- disablesmtpd smallint(1),
- disablesmtp smallint(1),
- disablewebmail smallint(1),
- disablenetdisk smallint(1),
- disableimap smallint(1),
- disablepop3 smallint(1),
- question text NOT NULL default '',
- answer text NOT NULL default '',
- PRIMARY KEY (username),
- KEY username (username)
- ) TYPE=MyISAM COMMENT='ExtMail - Virtual Mailboxes';
init.sql脚本:
- use extmail;
- /*!40000 ALTER TABLE `alias` DISABLE KEYS */;
- LOCK TABLES `alias` WRITE;
- INSERT INTO `alias` VALUES ('[email protected]','[email protected]','extmail.org','2007-02-14 15:10:04',1);
- UNLOCK TABLES;
- /*!40000 ALTER TABLE `alias` ENABLE KEYS */;
- /*!40000 ALTER TABLE `domain` DISABLE KEYS */;
- LOCK TABLES `domain` WRITE;
- INSERT INTO `domain` VALUES ('extmail.org','virtualDomain for extmail.org','A0/B0',50,50,1073741824,1073741824,NULL,'1','5242880','5242880','1y','0','0','0','0','1','0','2007-02-14 15:10:04','2010-11-08',1);
- UNLOCK TABLES;
- /*!40000 ALTER TABLE `domain` ENABLE KEYS */;
- /*!40000 ALTER TABLE `mailbox` DISABLE KEYS */;
- /* [email protected] password is extmail */
- LOCK TABLES `mailbox` WRITE;
- INSERT INTO `mailbox` VALUES ('[email protected]','postmaster','$1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0','','PostMaster','','extmail.org/postmaster/Maildir/','extmail.org/postmaster','104857600S','52428800S','extmail.org',1000,1000,'2007-02-14 15:10:04','2010-11-08',1,0,0,0,0,0,0,0,'my question','my answer');
- UNLOCK TABLES;
- /*!40000 ALTER TABLE `mailbox` ENABLE KEYS */;
- /*!40000 ALTER TABLE `manager` DISABLE KEYS */;
- /* [email protected] password is extmail*123* */
- LOCK TABLES `manager` WRITE;
- INSERT INTO `manager` VALUES ('[email protected]','$1$BrT9qxfB$Ha81Mb5YVV6rNKNN5jmtj1','admin','root','Super User','my question','my answer','0','2007-02-14 15:10:04','2010-11-08',1);
- UNLOCK TABLES;
- /*!40000 ALTER TABLE `manager` ENABLE KEYS */;
mysql_virtual_alias_maps.cf文件:
- user = extmail
- password = extmail
- hosts = localhost
- dbname = extmail
- table = alias
- select_field = goto
- where_field = address
- additional_conditions = AND active = '1'
mysql_virtual_limit_maps.cf文件:
- user = extmail
- password = extmail
- hosts = localhost
- dbname = extmail
- table = mailbox
- select_field = quota
- where_field = username
- additional_conditions = AND active = '1'
mysql_virtual_sender_maps.cf文件:
- user = extmail
- password = extmail
- hosts = localhost
- dbname = extmail
- table = mailbox
- select_field = username
- where_field = username
- additional_conditions = AND active = '1'
mysql_virtual_domains_maps.cf文件:
- user = extmail
- password = extmail
- hosts = localhost
- dbname = extmail
- table = domain
- select_field = domain
- where_field = domain
- additional_conditions = AND active = '1'
mysql_virtual_mailbox_maps.cf文件:
- user = extmail
- password = extmail
- hosts = localhost
- dbname = extmail
- table = mailbox
- select_field = maildir
- where_field = username
- additional_conditions = AND active = '1'
总共两个个脚本文件和五个数据库连接文件都在这里了,有想做实验的尽管尝试!