メール送受信(Postfix, Dovecot)

  • ローカルで動かす。
  • pop3で受ける。
  • とりあえず、セキュリティは考えない...

hostnameとiptablesの設定

$ sudo vi /etc/sysconfig/network

NETWORKING=yes
#HOSTNAME=localhost.localdomain
#HOSTNAME=www
HOSTNAME=www.hoge.local

$ sudo /sbin/iptables -F

Postfixのインストール

$ sudo yum -y install postfix

Sendmailの停止

$ sudo /etc/init.d/sendmail stop
$ sudo /sbin/chkconfig  --level 2345 sendmail off
$ sudo /sbin/chkconfig  --list sendmail 

mtaをPostfixに変更

$ sudo /usr/sbin/alternatives --config mta

/usr/sbin/sendmail.postfixを選択してenter

  • 確認
$ sudo /usr/sbin/alternatives --display mta

Postfix自動起動の設定の確認

$ /sbin/chkconfig --list|grep postfix
$ sudo /sbin/chkconfig --level 2345 postfix on

Postfix設定ファイルの編集

$ sudo vi /etc/postfix/main.cf

myhostname = www.hoge.local
mydomain = hoge.local
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
relay_domains = $mydestination

Postfixを起動

$ sudo /etc/rc.d/init.d/postfix start

Dovecotのインストール

$ sudo yum -y install dovecot

Dovecotの設定

$ sudo vi /etc/dovecot.conf

protocols = pop3

Dovecot自動起動の設定

$ sudo /sbin/chkconfig dovecot on
$ /sbin/chkconfig --list dovecot

Dovecotの起動

$ sudo /etc/init.d/dovecot start