How to Use Google Workspace Gmail with nodeBB [2021]

How to use Google G Suite Gmail to send emails from nodebb
Like Love Haha Wow Sad Angry

Google Workspace, formerly known as Google G Suite, is a versatile system that includes Gmail and other google applications. It can be used for personal or business reasons.

Setting up a mail server is fairly time consuming and requires a lot of work in order to ensure emails are deliverable.

Namely, there are measures you need to implement in order to make your mail server free of spam. In fact, if it’s not setup properly then your emails will likely end up in the spam folder.

Luckily, Google Workspace Gmail makes it easy to setup your own mail server so that emails come from @your_domain_name and not

Specifically, if you set up what’s known as SMTP relay, you don’t have to worry about managing the mail server, everything’s done for you. Plus, nodeBB is compatible with this right out of the box so no tinkering is required.

Benefits of using SMTP Relay for nodeBB:

  • Protects data – All emails sent are encrypted which helps protect sensitive data
  • Reduces undelivered emails – Emails are much more likely to arrive in the recipients inbox rather than the spam folder
  • Improves security – Gmail has a lot of spam filters and other filters that can detect and prevent malicious emails from ever being sent out or received

Step 1) Setup SMTP Relay in Google Workspace

First, let’s open up the SMTP relay settings.

  1. Login to your Google Workspace administrator account.
  2. Click Apps -> Google Workspace -> Gmail
  3. Workspace core services location in the admin dashboard

  4. Scroll down to the bottom until you find Advanced settings and click it
  5. Gmail advanced settings location

  6. Under General Settings, search for Relay
  7. Search for Relay under the advanced settings of Gmail in Google workspace to get SMTP relay

  8. Click Configure

Add a name for your SMTP relay. Now, change the settings to:

  • Allowed senders – Only addresses in my domains
  • Authentication – Only accept mail from the specified IP addresses. Add in your server’s IP address.
  • Encryption – ☑ Require TLS encryption

SMTP Relay settings in Google Workspace Gmail for allowing nodebb connections

Remember to click Add Setting and Save.

If your server runs on both IPv4 and IPv6 make sure you add both addresses.

Step 2) Configure nodeBB email for SMTP relay

Open up your nodeBB Admin dashboard and navigate to the email settings by clicking on Settings -> Email.

Scroll down until you get to the SMTP Transport section. Enable Use an external email server to send emails.

Under Select a service, choose Custom Service. Then change the settings to:

  • SMTP Host –
  • SMTP Port – 587
  • Connection security – StartTLS

Nodebb email settings for Google workspace Gmail SMTP relay

Make sure you save your settings.

Everything should be setup now.

Test your email by clicking on the Send Test Email button at the bottom.

If you need help leave a comment down below.

Troubleshooting Error 421

If you try sending a test email and you get a 421 error then you need to edit the emailing code to include your site’s domain name.

Server terminates connection. response=421 4.7.0 Try again later, closing connection. (EHLO) s22sm961094vkm.4 - gsmtp: 421 4.7.0 Try again later, closing connection. (EHLO) s22sm961094vkm.4 - gsmtp

The reason this happens is because Google’s SMTP relay host has been targeted by a DDoS attack.

To mitigate this, Google now requires domains identify themselves before connecting to the relay server. Otherwise, the connection will be denied.


  1. Open the file src/emailer.js
  2. Scroll down to line 120 where it says
    	const smtpOptions = {
    		pool: config['email:smtpTransport:pool'],
  4. Add this line under pool and add your domain namename: ‘your-domain-name.extension’,

For example, here’s how it would look like for this site:

	const smtpOptions = {
		pool: config['email:smtpTransport:pool'],
		name: '',

Save the file then Rebuild & Restart nodeBB.

If rebuilding doesn’t work then try running the command

./nodebb upgrade


./nodebb build


./nodebb start
Like Love Haha Wow Sad Angry

Leave A Comment