|
3、与MySQL结合的配置及数据表结构
注意:配置mysql相关部分要写127.0.0.1而不要写localhost,如果使用localhost,postfix会尝试socket连接。debian的postfix使用socket连接好像有问题。mysql不能使用skip-networking选项,要使用--bind-address=127.0.0.1让它监听在127.0.0.1。(非常感谢Martin List-Petersen指点)
还有要注意的是如果是自己编译的mysql,建议在启动的时候加上--socket=/var/run/mysqld/mysqld.sock参数,因为pam-mysql又需要使用这个socket。如果你的apache+PHP是自己编译的话,php又需要重新编译,配置的时候需要加上--with-mysql-sock=/var/run/mysqld/mysqld.sock参数。
是不是比较烦?这不过是个开始。
MySQL的数据表:
CREATE TABLE alias ( id int(11) unsigned NOT NULL auto_increment, alias varchar(128) NOT NULL default '''', destination varchar(128) NOT NULL default '''', PRIMARY KEY (id) ) TYPE=MyISAM;
CREATE TABLE relocated ( id int(11) unsigned NOT NULL auto_increment, email varchar(128) NOT NULL default '''', destination varchar(128) NOT NULL default '''', PRIMARY KEY (id) ) TYPE=MyISAM;
CREATE TABLE transport ( id int(11) unsigned NOT NULL auto_increment, domain varchar(128) NOT NULL default '''', destination varchar(128) NOT NULL default '''', PRIMARY KEY (id), UNIQUE KEY domain (domain) ) TYPE=MyISAM;
CREATE TABLE users ( id int(11) unsigned NOT NULL auto_increment, email varchar(128) NOT NULL default '''', clear varchar(128) NOT NULL default '''', name tinytext NOT NULL, uid int(11) unsigned NOT NULL default ''1011'', gid int(11) unsigned NOT NULL default ''1011'', homedir tinytext NOT NULL, maildir tinytext NOT NULL, quota tinytext NOT NULL, postfix enum(''Y'',''N'') NOT NULL default ''Y'', PRIMARY KEY (id), UNIQUE KEY email (email) ) TYPE=MyISAM;
CREATE TABLE virtual ( id int(11) unsigned NOT NULL auto_increment, email varchar(128) NOT NULL default '''', destination varchar(128) NOT NULL default '''', PRIMARY KEY (id) ) TYPE=MyISAM;
/etc/postfix目录下各mysql配置文件:
mysql-aliases.cf
user = mysql-postfix-user password = mysql-postfix-pass dbname = postfix table = alias select_field = destination where_field = alias hosts = 127.0.0.1
mysql-relocated.cf
user = mysql-postfix-user password = mysql-postfix-pass dbname = postfix table = relocated select_field = destination where_field = email hosts = 127.0.0.1
mysql-transport.cf
user = mysql-postfix-user password = mysql-postfix-pass dbname = postfix table = transport select_field = destination where_field = domain hosts = 127.0.0.1 |
关键词:邮件 |