ワイ、そして IT ときどき何か。

日々のとりとめのない記録

Postfix Dovecot でメールが届かない(受信出来ない)場合の確認事項

以下は IMAP の場合だったりするけど POP3 でも当てはまる場合もあるかも。

Postfix

1. mydestination の値が正しいか($ vim /etc/postfix/main.cf)
 例) mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

2. home_mailbox を設定しているか($vim /etc/postfix/main.cf)
 例)# home_mailbox = Maildir/home_mailbox = Maildir/(# を削除する)

3. サブミッションポートを有効にしているか($ vim /etc/postfix/master.cf)
 例)

#submission inet n - n - - smtpd
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING

   ↓
submission inet n - n - - smtpd
# -o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING

とコメントを削除して有効にする。


Dovecot

1. mail_location の値が正しいか($ vim /etc/dovecot/conf.d/10-mail.conf)
 例) mail_location = maildir:~/Maildir


iptables(ファイアウォール) 編

1. 25番ポートを空ける
2. その他のポートを空ける(110、143、465、587、993、995など)


Aliases(エイリアス)
エイリアスとは、例えば mail@example.com 宛に送ったメールは root@example.com に転送されるメールアドレス(ユーザ名)のこと。

1. 以下の文字列のユーザ名がいる場合、コメントアウトをするなどでエイリアスに転送しないようにする(webmaster、info、security、marketing、sales、support などは注意。$ vim /etc/aliases で # を付けるなりその行を削除するなり)

# Basic system aliases -- these MUST be present.
mailer-daemon: postmaster
postmaster: root

# General redirections for pseudo accounts.
bin: root
daemon: root
adm: root
lp: root
sync: root
shutdown: root
halt: root
mail: root
news: root
uucp: root
operator: root
games: root
gopher: root
ftp: root
nobody: root
radiusd: root
nut: root
dbus: root
vcsa: root
canna: root
wnn: root
rpm: root
nscd: root
pcap: root
apache: root
webalizer: root
dovecot: root
fax: root
quagga: root
radvd: root
pvm: root
amanda: root
privoxy: root
ident: root
named: root
xfs: root
gdm: root
mailnull: root
postgres: root
sshd: root
smmsp: root
postfix: root
netdump: root
ldap: root
squid: root
ntp: root
mysql: root
desktop: root
rpcuser: root
rpc: root
nfsnobody: root

ingres: root
system: root
toor: root
manager: root
dumper: root
abuse: root

newsadm: news
newsadmin: news
usenet: news
ftpadm: ftp
ftpadmin: ftp
ftp-adm: ftp
ftp-admin: ftp
www: webmaster
webmaster: root
noc: root
security: root
hostmaster: root
info: postmaster
marketing: postmaster
sales: postmaster
support: postmaster


DNS

1. 上位の DNS で MX の設定をしているか


再起動

1. 再起動しないと設定の変更が適応されないので再起動すること
CentOS 6

$ service postfix restart
$ service dovecot restart
$ service iptables restart
$ service named restart

CentOS 7

$ systemctl restart postfix
$ systemctl restart dovecot
$ systemctl restart iptables
$ systemctl restart named



これでも無理な場合は、最悪 Google Apps のメールサービスを使うのも良いかも。
なにせスパムメールもブロックしてくれるし自由度が高いし、ユーザの追加も楽。
https://www.google.com/intx/ja_jp/work/apps/business/
但しユーザ一人あたり 500円/月となると 10人で 5,000円(+税) /月になるので割高か。