Using Postfix with Discourse

So I installed Postfix in my server with discourse (I know its not suggested).
My Postfix works fine and I send email with it.

The issue is with Discourse/docker not wanting to send email (can’t even get the admin activation)

I read that:

  1. It is a docker issue
  2. You shouldn’t have postfix in the same server
  3. I will be put in the spam box pretty fast

What are you guys using as an smtp server?

Postfix and Discourse are perfectly compatible so I suggest you change the title of your topic accordingly :wink:
You probably have a configuration issue.

If you configure everything right then you will deliver everything straight into inbox.

2 Likes

I tried every configuration in the book.

For my postfix /etc/postfix/main.cf:

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = discourse-mydomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = discourse-mydomain, mydomain.com, discourse-mydomain, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128, 140.82.40.82, 172.17.0.2
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = 172.17.0.1
inet_protocols = all
home_mailbox = Maildir/
virtual_alias_maps = hash:/etc/postfix/virtual

I actually even changed the inet_interfaces to match my docket container.

  DISCOURSE_SMTP_ADDRESS: mail.mydomain.com
  #DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME:
  DISCOURSE_SMTP_PASSWORD:
  #DISCOURSE_SMTP_ENABLE_START_TLS: true

Don’t see where the config is wrong. any ideas?

Welcome to the forum, @cmoi! Glad to have you here. :wave:

I find mandrillapp.com and mailgun.com to be pretty solid.

Does anyone know where is my mail logs sent by Discourse?

Maybe you can start by telling us what your actual problem is instead of “does not work”…

  • What are you doing? (please be verbose)
  • What is your expected outcome?
  • What is happening instead?
  • Do you see any error messages?
  • Is there anything else worth telling us?
3 Likes

I actually gave up and took Amazon SES instead.

1 Like

Hey There,

Running into a similar issue with a Bitnami docker container of Discourse. The emails just aren’t sending.
Here is the error I’m getting:
There was a problem sending the test email. Please double-check your mail settings, verify that your host is not blocking mail connections, and try again.

Here are my SMTP settings:

Delivery Method
address smtp.sengrid.net
port 465
user_name apikey
authentication login
enable_starttls_auto true

Any guidance on where I need to look/troubleshoot next?

Edit: Have tried 587, plain authentication method, different apikey/password. Have setup this on other apps no problem with similar settings.

Expected outcome is for the email to send from Discourse to the inbox of the test account.

Sincerely,
Jared

Yes. Follow the Discourse official Standard Installation and see if the problem persists.

EDIT: it’s also possible that your VM is blocking port 465. You might try 2525 (not sure if sendgrid supports that, but they probably do).

3 Likes