Gmail SMTP Relay Setup not working

Hi Folks,

I’ve installed discourse on an Ubuntu 18.04 by this guide (it’s with Ubuntu 16.04, but I think its quite the same):

Then I setup the email configuration like here discribed:

Note: It dont worked for me to apply just a IP range, only full IP-Address worked.

But I still dont get emails working. When I do the doctor test, it says:

==================== MAIL TEST ====================
SMTP server connection successful.
Sending to . . 
Sending mail failed.
Replacing: Sending mail to

==================== DNS PROBLEM ====================
This server reports NOT FOUND, but reports Discourse 2.4.0.beta2 .
This suggests that you have a DNS problem or that an intermediate proxy is to blame.
If you are using Cloudflare, or a CDN, it may be improperly configured.

I also tried to set “Allowed senders” in the gmail suite to “all”, but that also not helped.

And of curse, if I try to setup the admin account, I just dont get a mail…

Can anybody help me here, cant be possible that thats so hard to setup ^^

Kind regards,

Relaying through Gmail is a violation of their Terms of Service, so we do not support it. We recommend using a service like Mailgun.

1 Like

Hmm. So maybe you’ve got a reverse proxy? Since

You’re in good shape there.

If you’re paying for Gsuite (and not Gmail) it’s not a violation of their TOS to have Discourse send mail, but it’s still a huge pain and you can’t get much help here. If you have a credit card your life will be much easier if you go with Mailgun (or similar).


Probably a bit late to help you here, but I can confirm it is possible to use GSuite smtp-relay to send your Discourse emails.

The following is a configuration for using the smtp-relay (in Gmail app settings) with no authentication (IP address only). First as you say, you need to configure the app settings to “Only accept mail from the specified IP addresses”, adding the addresses of your Discourse server.

The configuration on Discourse side is then –

DISCOURSE_SMTP_PORT: 587                        

They key thing, and what tripped me up for an hour or so, is that you need to specify the username and password vars but leave them blank. Any other values (none, ‘’, etc.) won’t work.


No this does not work. And no shade it is a terrible platform idea to require both domains and mail servers as when you change the DNS on most domain providers their local email server gets messed up. Ive been trying to get this installed for 4 hours now.

Thanks for the workaround! I can confirm it works :slight_smile:


This worked for me just now