Question

How to Update Disocourse Forum SMTP?

I used the One-Click Install for Discourse. During install and setup of the Admin, I forgot that Gmail addresses don’t work with Discourse. What command do I use from the droplet console to update SMTP to the transactional mail service I have now?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
October 30, 2023

Hello, @muiren

You can update the Discourse SMTP settings by running the following command in your droplet console:

  1. sudo discourse-setup

This will open the Discourse setup wizard, where you can update the SMTP settings.

To update the SMTP settings, select the “SMTP” tab and enter the following information:

  • SMTP server: The address of your SMTP server.
  • SMTP port: The port number for your SMTP server.
  • SMTP username: The username for your SMTP server.
  • SMTP password: The password for your SMTP server.

Once you have entered the SMTP settings, click the “Save” button.

After you have updated the SMTP settings, you need to restart the Discourse service. To do this, run the following command:

  1. sudo systemctl restart discourse

Once the Discourse service has restarted, you should be able to send and receive emails from your Discourse forum using your transactional mail service.

Note: If you are using a transactional mail service such as Amazon SES or SendGrid, you will need to generate an API key and enter it in the Discourse setup wizard.

Here is an example of how to update the Discourse SMTP settings to use Amazon SES:

  1. Open the Discourse setup wizard:
  1. sudo discourse-setup
  1. Select the “SMTP” tab.

  2. Enter the following information:

    • SMTP server: email-smtp.us-east-1.amazonaws.com
    • SMTP port: 587
    • SMTP username: Your_SES_Username
    • SMTP password: Your_SES_API_Key
  3. Click the “Save” button.

  4. Restart the Discourse service:

  1. sudo systemctl restart discourse

Once you have completed these steps, you should be able to send and receive emails from your Discourse forum using Amazon SES.

KFSys
Site Moderator
Site Moderator badge
October 30, 2023

Heya @muiren,

If you’ve installed Discourse using the one-click install and wish to update your SMTP settings after the fact, you’ll need to modify the app.yml configuration file and then rebuild the Discourse container.

Here are the steps to update the SMTP settings:

SSH into your droplet:

ssh root@Your_Droplet_IP

Navigate to the Discourse Docker directory and edit the app.yaml:

cd /path/to/directory/of/discourse

Once in there do

`nano containers/app.yml`

Find and update the SMTP settings. They usually look something like this:

DISCOURSE_SMTP_ADDRESS: smtp.example.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: user@example.com
DISCOURSE_SMTP_PASSWORD: yourpassword
# DISCOURSE_SMTP_ENABLE_START_TLS: true         # (optional, true by default)

Update the above values with your transactional mail service details.

Save and exit. If you’re using nano, you can do this by pressing CTRL + X, then Y, then Enter.

Rebuild the Discourse container. This step applies the changes you made to the app.yml file.

./launcher rebuild app

The rebuild process may take a few minutes. Once completed, your Discourse instance should now use your new transactional mail service for sending emails.

Remember, if you’re using a new SMTP service, ensure you have set up SPF and DKIM records properly for your domain to avoid email deliverability issues. Also, double-check that your mail service allows the volume of transactional emails required for your forum and that it doesn’t block or rate-limit messages coming from your Discourse instance.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel