csmu
(Keith John Hutchison - Ceiteach Seán Mac Úistin)
2019 年 12 月 23 日午前 8:33
1
新しい Discourse インスタンスでメールが送信されない理由を特定するために、Troubleshoot email on a new Discourse install - #2 を参照して作業しています。
デバイスから swaks を使用してメールを送信することは可能です。
完全修飾ドメイン名を設定した後、smtp.office365.com の 587 ポートに telnet で接続できます。
本番環境のログにはエラーは見当たりません。
tail -f shared/web_only/log/rails/production.log
Started POST "/u/action/send_activation_email" for 115.64.14.90 at 2019-12-23 08:20:28 +0000
Processing by UsersController#send_activation_email as */*
Parameters: {"username"=>"csmu"}
Rendering text template
Rendered text template (Duration: 0.1ms | Allocations: 1)
Completed 200 OK in 36ms (Views: 1.0ms | ActiveRecord: 0.0ms | Allocations: 4557)
tail -f shared/web_only/log/var-log/mail.log を実行すると、以下のようなメッセージが表示されます。
Cannot open main log file "/var/log/exim4/mainlog"
なぜ “/var/log/exim4/mainlog” がロックされ、shared/web_only/log/var-log/mail.log で参照されているのか、何か心当たりはありますか?
csmu
(Keith John Hutchison - Ceiteach Seán Mac Úistin)
2019 年 12 月 24 日午前 1:17
2
そのログは誤検知でした。
主な問題は smtp.office365.com との通信でした。
デバイスを有効な完全修飾ドメイン名 (FQDN) を使用するように設定する必要がありました。それまで、
telnet smtp.office365.com 587
は失敗していました。
yaml ファイルに正しい設定を適用する必要がありました。特に DISCOURSE_SMTP_AUTHENTICATION: login です。
DISCOURSE_SMTP_ADDRESS: smtp.office365.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: discourse@domain
DISCOURSE_SMTP_PASSWORD: "validPassword"
DISCOURSE_SMTP_AUTHENTICATION: login
DISCOURSE_SMTP_ENABLE_START_TLS: true
SiteSetting.notification_email を設定する必要がありました。
./launcher enter web_only
root@discourse-web-only:/var/www/discourse# rails console
[1] pry(main)> SiteSetting.notification_email = "discourse@domain"
[2] pry(main)> exit
root@discourse-web-only:/var/www/discourse# exit
コンテナを再起動しました。
./launcher destroy web_only
./launcher start web_only
完了です!