参考:
http://centossrv.com/postfix.shtml
メール関連パッケージインストール
$ apt-get install postfix dovecot-common dovecot-pop3d dovecot-imapd sasl2-bin
postfix設定(SMTP)
$ sudo vi /etc/postfix/main.cf
変更箇所
myorigin = mydomain.com
myhostname = mail.mydomain.com
mydomain = mydomain.com
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions =
permit_mynetworks
permit_sasl_authenticated
reject_unauth_destination
SMTP-Auth設定(認証にシステムのユーザー名、パスワードを使用する)
$ sudo service saslauthd start
$ chkconfig saslauthd on
新規ユーザー用Maildirテンプレート作成
$ mkdir -p /etc/skel/Maildir/{new,cur,tmp}
$ chmod -R 700 /etc/skel/Maildir/
Postfix起動
$ sudo service postfix start
$ chkconfig postfix on
Dovecot設定(POP、IMAP)
$ sudo vi /etc/dovecot/conf.d/10-mail.conf
変更箇所
mail_location = maildir:~/Maildir
disable_plaintext_auth = no
Dovcot起動
$ sudo service dovecot start
$ chkconfig dovecot on
メールユーザー追加
$ echo "password" | saslpasswd2 -p -u linux.mydomain.com -c mailtest
$ sasldblistusers2
$ chgrp postfix /etc/sasldb2
$ saslpasswd2 -d mailtest -u linux.mydomain.com