質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Dovecot

Dovecotとは、POPやIMAPサーバーを提供するMDA(メール配送エージェント)の一つです。

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Postfix

Postfixは、電子メールサーバソフトウェアで、 メールを配送するシステムMTAの一種です。

Q&A

解決済

2回答

8572閲覧

postfixでメール送信ができない

OldRiver

総合スコア59

Dovecot

Dovecotとは、POPやIMAPサーバーを提供するMDA(メール配送エージェント)の一つです。

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Postfix

Postfixは、電子メールサーバソフトウェアで、 メールを配送するシステムMTAの一種です。

0グッド

0クリップ

投稿2017/09/07 09:00

編集2017/09/07 09:01

さくらのクラウドにCentos7の新規環境に
postfixとdovecotを利用してメールサーバを構築したのですが
メールが送信できない状態です。

telnetで接続確認をしましたが143ポートは接続できますがポート25と587は接続が拒否されます。selinuxとfirewallを無効にしても同じ結果となります(ポート25はOP25B問題があるため外部の別のWi-Fiに繋いだ場合ポート25だけは接続できました。)。
ネットで調べましたが有効な対応方法が見つからないため詳しい方教えてください。

Telnetでの接続結果

terminal

1$ telnet mail.domainname 587 2 3Trying [ipアドレス]... 4telnet: connect to address [ipアドレス]: Connection refused 5telnet: Unable to connect to remote host

サーバー上でsendmeilで自分宛てにメールを送信試したところ以下のエラーが出ています。

terminal

1# cat /var/log/maillog 2 3Sep 7 17:04:23 hostname postfix/pickup[1165]: 44F824155: uid=0 from=<info@domainname> 4Sep 7 17:04:23 hostname postfix/cleanup[1277]: 44F824155: message-id=<20170907080423.44F824155@mail.domainname> 5Sep 7 17:04:23 hostname postfix/qmgr[1166]: 44F824155: from=<info@domainname>, size=264, nrcpt=1 (queue active) 6Sep 7 17:04:23 hostname postfix/local[1279]: 44F824155: to=<info@domainname>, relay=local, delay=1.8, delays=1.7/0.01/0/0.01, dsn=5.2.0, status=bounced (cannot update mailbox /home/info/Maildir for user info. cannot open file: Is a directory) 7Sep 7 17:04:23 hostname postfix/cleanup[1277]: 4EA2B7BC2: message-id=<20170907080423.4EA2B7BC2@mail.domainname> 8Sep 7 17:04:23 hostname postfix/qmgr[1166]: 4EA2B7BC2: from=<>, size=2207, nrcpt=1 (queue active) 9Sep 7 17:04:23 hostname postfix/bounce[1280]: 44F824155: sender non-delivery notification: 4EA2B7BC2 10Sep 7 17:04:23 hostname postfix/qmgr[1166]: 44F824155: removed 11Sep 7 17:04:23 hostname postfix/local[1279]: 4EA2B7BC2: to=<info@domainname>, relay=local, delay=0.01, delays=0/0/0/0, dsn=5.2.0, status=bounced (cannot update mailbox /home/info/Maildir for user info. cannot open file: Is a directory) 12Sep 7 17:04:23 hostname postfix/qmgr[1166]: 4EA2B7BC2: removed

ポートを確認したところ25,587ポートはLISTEN状態になっています。

terminal

1# ss -natu 2 3Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port 4udp UNCONN 0 0 127.0.0.1:323 *:* 5udp UNCONN 0 0 ::1:323 :::* 6tcp LISTEN 0 100 127.0.0.1:587 *:* 7tcp LISTEN 0 100 *:110 *:* 8tcp LISTEN 0 100 *:143 *:* 9tcp LISTEN 0 100 127.0.0.1:25 *:* 10tcp LISTEN 0 128 *:48353 *:* 11tcp ESTAB 0 284 [サーバのIP]:48353 182.251.26.107:47200 12tcp ESTAB 0 0 [サーバのIP]:48353 61.200.22.212:56932 13tcp LISTEN 0 100 ::1:587 :::* 14tcp LISTEN 0 100 :::110 :::* 15tcp LISTEN 0 100 :::143 :::* 16tcp LISTEN 0 32 :::21 :::* 17tcp LISTEN 0 100 ::1:25 :::* 18tcp LISTEN 0 128 :::48353 :::* :::*

postfixとdovecotは以下の設定をしています。

terminal

1# vi /etc/postfix/main.cf 2 3 local_recipient_maps = 4 luser_relay = unknown_user@localhost 5 myhostname = mail.domainname 6 mydomain = domainname 7 myorigin $mydomain 8 inet_interfaces = all 9 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain 10 home_mailbox = Maildir 11 smtpd_banner = $myhostname ESMTP unknown 12 smtpd_sasl_auth_enable = yes 13 smtpd_recipient_restrictions = 14 permit_mynetworks 15 permit_sasl_authenticated 16 reject_unauth_destination 17 message_size_limit = 10485760

terminal

1# vi /etc/postfix/master.cf 2 3 submission inet n - n - - smtpd 4 -o smtpd_sasl_auth_enable=yes

terminal

1# vi /etc/sasl2/smtpd.conf 2 3 # pwcheck_method: saslauthd 4 pwcheck_method: auxprop

terminal

1# vi /etc/dovecot/conf.d/10-mail.conf 2 3 mail_location = maildir:~/Maildir 4 disable_plaintext_auth = no

teriminal

1# vi /etc/dovecot/conf.d/10-ssl.conf 2 ssl = no

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

/etc/postfix/main.cfhome_mailboxhome_mailbox = Maildirではなくhome_mailbox = Maildir/ではないですか?

投稿2017/09/07 12:21

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

OldRiver

2017/09/07 17:09

ご指摘の通り home_mailbox = Maildir/ を修正したところメールサーバ上で自分宛てのsendmailが送受信できるようになりました。
guest

0

ベストアンサー

postfix は localhost(127.0.0.1, ::1) しか LISTEN していないため、外部から接続できません。
inet_interfaces = all に設定した後、restart していないのではないでしょうか?

また、home_mailbox = Maildir/ と最後に「/」(スラッシュ)を付けないと、mbox 形式とみなされるため、

(cannot update mailbox /home/info/Maildir for user info. cannot open file: Is a directory)

のエラーとなっています。

投稿2017/09/07 12:21

TaichiYanagiya

総合スコア12146

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

OldRiver

2017/09/07 17:21

回答ありがとうございます。 home_mailboxは「Maildir/」でした。 自分宛てのsendmailのみ送受信できるようになりました。 ポート番号だけ確認してlocalhostであることを見落としていました。 /etc/postfix/main.cf をよく見直したところ 「inet_interfaces = all」のコメントを解除して設定はしていましたが3行下にもともと記載されていた「inet_interfaces = localhost」をコメントアウトし忘れていたのが原因でした。 この設定で外部の自分のgmailとのメールの送受信もできるようになりました。 最後にThunderbirdでメールアカウントを設定時にアカウントが見つからない問題がありましたがこちらは /var/log/maillog に「fatal: no SASL authentication mechanisms」が出ていました。 /etc/dovecot/conf.d/10-mail.conf に誤って設定していた「 disable_plaintext_auth = no」を「/etc/dovecot/conf.d/10-auth.conf」に移動し、cyrus-sasl-plainとcyrus-saslをインストールしてsaslauthdを起動することで解決しました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問