Mail problem on discourse with reverse proxy

I have configured in my app.yml the mail to be something like

  DISCOURSE_SMTP_ADDRESS: mail.mysecrect.tld
  DISCOURSE_SMTP_USER_NAME: minegenix@mysecret.tld

Also found this on logs:

Delivered mail 3ff63fed-4142-4042-ab33-29493b32b3a6@beta2.mysecret.tld (30001.9ms)
Job exception: execution expired

you might need to add this to your app.yml


Okay, btw i use mailcow!

Is the server running discourse beta2.mysecret.tld - and not mysecret.tld?

Give these options a try:

DISCOURSE_SMTP_ADDRESS: # use internal ip here - mail-server domain might not get resolved correctly
#DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

mysecret.tld is just placeholder hiding my real domain as i don’t want to reveal my forum address :slight_smile:

Are you sending mails with sender email like “…@ beta2. mysecret.tld” - but your mailcow account is for “…@mysecret.tld”?

no im sending emails from …@ mysecret.tld and the site is running at beta2.mysecret.tld

@Sprisa add the setting i posted and rebuild.

see if that helps.

@rrit you are missing the plot :man_facepalming:

1 Like

yeah im currently doing that

1 Like

btw do i need to bootstrap everytime after rebuild?

Okay i added the settings, didn’t help.

How to debug issues with first connection to smtp server

1. Enter your container:

./launcher enter app

2. Check dns resolution for your smtp server name via getent hosts:

(dig, nslookup, ping etc. are not installed inside the container.)

getent hosts your.smtp.server

Result on success:

# IPv4 your.smtp.server

# IPv6
2001:db8:0:0:0:ff00:42:8329 your.smtp.server

3. Try to open a connection to your smtp server via openssl:

(telnet, nc etc. are not installed inside the container.)

Fiddle with some different settings until you succeed with a connection.

openssl s_client -connect your.smtp.server:465
openssl s_client -connect your.smtp.server:587 -starttls smtp

# IPv4
openssl s_client -connect
openssl s_client -connect -starttls smtp

# IPv6
openssl s_client -6 -connect "[2001:db8:0:0:0:ff00:42:8329]:465"
openssl s_client -6 -connect "[2001:db8:0:0:0:ff00:42:8329]:587" -starttls smtp

See: How to check SMTP connection → Step 3: Checking SMTP Connection Over TLS Using Openssl

4. Use your found working connection settings with Discourse.


Bonus: show Discourse IP from inside docker container

( ifconfig , ip etc. are not installed inside the container.)

hostname -I

Result like:

I can’t get connection with openssl, also i only get this: from the getent

2606:4700:3032::ac43:d2f1 mail.secret.tdl
2606:4700:3033::6815:4db8 mail.secret.tld

(secret.tld replacing my actual domain)

A shot in the dark: Is this a public IP? Is your mailcow configured to listen for smtp-connections on this public IP or only on an internal network?

Inside the Discourse container you can get your containers IP via:

hostname -I

Is your mailcow also on the same internal (docker-)network? is the thing i get from hostname -I

Can you get into your mailcow container and also get hostname -I? Are Mailcow and Discourse two seperate docker-containers on the same host?

how do i get into the mailcow container? there isn’t launcher script.

I don’t know about mailcow either. Maybe better check back with the mailcow community:

What should i use to get mail systems, or what software can I setup on ubuntu that would work as mail service on my forums?