SMTPサーバーは接続するが、メールの送信に失敗

==================== MAIL TEST ====================
For a robust test, get an address from http://www.mail-tester.com/
Sending mail to REDACTED  . . 
Testing sending to callumokane123@gmail.com using support@maniabots.xyz:REDACTED@smtp.zoho.com:587.
SMTP server connection successful.
Sending to callumokane123@gmail.com. . . 
Sending mail failed.

==================== DONE! ====================

And I do not get the activation email for setting up account

Any help is appreciated :stuck_out_tongue_closed_eyes:

My guess is that your forum is called forum.maniabots.xyz and is sending from noreply@forum.maniabots.xyz and your mail server won’t do it. There is a line at the bottom of app.yml that you can change to set the address. You have to edit it by hand.

Can you explain more in detail, my site is located at support.maniabots.xyz and the email is support@maniabots.xyz, my app.yml Config looks fine

## Any custom commands to run after building
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  - exec: rails r "SiteSetting.notification_email='support@maniabots.xyz'"
  - exec: echo "End of custom commands"

I have made sure the lines are uncommented and the email is correct now and I have rebuilt the container but I still receive no verification email

Sorry. That was my best guess.

So, what do I need to do? I can give you access to the server if needed to help me!

Sorry. I’ve done my best here and have no more ideas.

If you want me to solve your problem, then you can see my installation packages: Discourse Installation Packages — Literate Computing, LLC.

I can configure Mailgun for you and it will work. There are a hundred different things that might be causing your custom mail server not to work.

Well, I don’t want to reconfigure my mail stuff with my domain and don’t want to be spending more money for mailgun

You’d not need to change any of your existing mail stuff and Mailgun is free for the first 10K messages/month.

こんにちは皆さん、
この問題に対する解決策が見つかりましたか?
Docker ホストに Postfix を設定して、送信メールを処理するようにしました。SSH から mail コマンドでメールを送信するときは問題なく動作するのですが、Discourse Docker では OP と同じエラーが発生します。このスレッドのヒント:How to set SMTP config to use localhost? を参考に、Discourse Docker からメールサーバーへの接続時にユーザー名とパスワードを指定しなくても認証エラーが出ないようにしました。しかし、今度は「送信に失敗しました」というエラーが出るようになりました。何かご存知の方はいらっしゃいますか?

メールサーバーの設定が、Discourse の導入プロセスで最も難しい部分になるとは思いもしませんでした… :frowning: Discourse のインストールは完璧で、あらゆる Linux のメールサーバー設定とは比べ物にならないほどよく考えられています。

よろしくお願いいたします!

そのため、すべてのインストール手順では、メールサーバーの構築は試さないよう記載されています。現在、メールサーバーを運用するのは非常に困難です。

私の推測では、Discourse は送信元のメールアドレスにホスト名を使用しているため、あなたのメールサーバーがそれを送信していないのでしょう。しかし、問題の原因は数十種類あり、それらはすべてここで得られるサポートの範囲を超えています。

この問題の解決策を探している方のために——私は解決しました。以下の投稿が非常に役立ちました:How to get Discourse to work with Postfix - #11 by shu_kaze - Linux - Level1Techs Forums

問題は、Discourse が Docker 環境から Postfix サーバーに接続できなかったことです。技術的には、接続は別のネットワークから行われるため、Postfix の許可ネットワークリストにそのネットワークが含まれていませんでした。Postfix の設定にある mynetworks に Docker ネットワーク(私の場合は 172.17.0.0/16)を追加するだけで動作するようになります。

まず、Docker から Postfix への接続自体が可能か確認する必要があります(Postfix での「許可されたネットワーク」チェックが実行される前に、接続が確立できるかどうか)。また、inet_interfaces の設定も確認してください。Discourse が Docker 内で動作するため、localhost では機能しないため、私は all を設定しました。

それでも動作しない場合は、Postfix のログを確認してください。私の場合は /var/log/mail.log ファイルにあります。

この情報が将来誰かの役に立てば幸いです。動作させるまでに長い日数を要しましたが、今では有料のメールサービスに依存せずに無料で運用できています(ドメインに SPF レコードを追加することを忘れないでください。そうしないと、Gmail や他のメールプロバイダーがメールをブロックし、スパムフォルダにも入らず、配信されないままになります)。