Comment faire fonctionner Discourse avec Postfix

After some trials and errors, I’ve been able to make Discourse work with Postfix. Here are steps that I’ve used, hope they can be helpful:

  1. Set a A record to point to your new server, says forum.domain.com

  2. install postfix, set forum.domain.com as myhostname and add 172.17.0.0/16 to mynetworks so Discourse container can talk with Postfix without authentication. 172.17.0.0/16 is the default network used by Docker containers.

  3. Make sure postfix can sending out emails. I prefer using swaks

    swaks -t your_name@gmail.com
    

    You should receive an email “This is a test mailing”.

  4. In containers/app.yml, make sure to comment out the 3 lines for DISCOURSE_SMTP_USER_NAME, DISCOURSE_SMTP_PASSWORD and DISCOURSE_SMTP_ENABLE_START_TLS

    and set DISCOURSE_SMTP_DOMAIN to the forum.domain.com (make sure to replace by your domain name here)

  5. To test, you can connect to the Discourse container by docker exec -it app bash and run:

    apt update
    apt install -y swaks
    swaks -t name@gmail.com --server forum.domain.com
    

    You should receive an email “This is a test mailing”.

  6. Restart discourse with ./launcher rebuild app. You should now be able to create new account and receive verification email.

2 « J'aime »