How can I replace the smtp server configured in discourse?

Assuming you followed the standard install, the SMTP settings used during discourse setup are stored in the app.yml

Look in /var/discourse/containers

After editing that file you can either run a rebuild from the terminal, or the shorter:

./launcher destroy app && ./launcher start app