Configure Gmail as a relay host

This page provides a guide for configuring DMS to use GMAIL as an SMTP relay host.

Configuration via ENV

Configure a relay host in DMS. This example shows how the related ENV settings map to the Gmail service config:

  • RELAY_HOST should be configured as advised by Gmail, there are two SMTP endpoints to choose:
    • (for a personal Gmail account)
    • (when using Google Workspace)
  • RELAY_PORT should be set to one of the supported Gmail SMTP ports (eg: 587 for STARTTLS).
  • RELAY_USER should be your gmail address (
  • RELAY_PASSWORD should be your App Password, not your personal gmail account password.
# Alternative to RELAY_HOST + RELAY_PORT which is compatible with LDAP:


  • As per our main relay host docs page, you may prefer to configure your credentials via setup relay add-auth instead of the RELAY_USER + RELAY_PASSWORD ENV.
  • If you configure for, the DEFAULT_RELAY_HOST ENV should be all you need as shown in the above example. Credentials can be optional when using Google Workspace (, which supports restricting connections to trusted IP addresses.

Verify the relay host is configured correctly

To verify proper operation, send an email to an external account of yours and inspect the mail headers.

You will also see the connection to the Gmail relay host ( in the mail logs:

postfix/smtp[910]: Trusted TLS connection established to[]:587:
  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
postfix/smtp[910]: 4BCB547D9D: to=<>,[]:587,
  delay=2.9, delays=0.01/0.02/1.7/1.2, dsn=2.0.0, status=sent (250 2.0.0 OK  17... - gsmtp)