FAQ
1. 启动 postfix 报错
#/usr/sbin/postfix start
postfix: fatal: /etc/postfix/main.cf, line 34: missing '=' after attribute name: "permit_mynetworks,"
原因 smtpd_recipient_restrictions =后面的选项要连续,不能换行
改成
smtpd_recipient_restrictions =permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination,permit
2. 不能正常启动 postfix ,无报错
查看 tail -f /var/log/maillog
Jun 16 17:57:45 ud20009 postfix/postfix-script[2770]: starting the Postfix mail system
Jun 16 17:57:45 ud20009 postfix/master[2771]: fatal: /etc/postfix/master.cf: line 103: bad transport type: user=vmail:vmail
修改
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}

3.fatal: open database /etc/aliases.db: No such file or directory
文件存在,但是格式不对,导致的原因可能是aliases.db文件是由Berkeley DB版本1创建的,
但是你现在使用的是版本2或者3,或者这个文件是用btree格式建立的,但是postfix能识别的格式是hash,
解决的方法是以root的身份执行newaliases,这样就能建立一个postfix能识别的aliases.db文件。
# touch /etc/aliases
# newaliases
4. warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
warning: unsupported SASL server implementation: cyrus
fatal: SASL per-process initialization failed
warning: process /usr/libexec/postfix/smtpd pid 16840 exit status 1
warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
原因2.3版本以后需要加入对CYRUS的认证
解决方法 加入-DUSE_CYRUS_SASL选项,重新编译。
make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include -DUSE_CYRUS_SASL -I/usr/local/include/sasl' 'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm -L/usr/local/lib -lsasl2'
make && make install

5. postfix启动报错
Jun 17 12:09:25 ud20009 postfix/smtpd[11023]: warning: smtpd_sasl_auth_enable is true, but SASL support is not compiled in
Jun 17 12:09:25 ud20009 postfix/smtpd[11023]: connect from unknown[125.34.78.179]
Jun 17 12:09:25 ud20009 postfix/trivial-rewrite[11026]: warning: do not list domain win123.cn in BOTH virtual_mailbox_domains and relay_domains
原因还是在编译postfix时没有 加入-DUSE_SASL_AUTH。
正确的是
make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include \
-DUSE_CYRUS_SASL -DUSE_SASL_AUTH -I/usr/local/include/sasl' \
'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm -L/usr/local/lib -lsasl2'
make && make install