# Using Postfix with Discourse

**URL:** https://meta.discourse.org/t/using-postfix-with-discourse/153841
**Category:** Self-hosting
**Created:** [June 4, 2020, 4:17pm UTC](https://meta.discourse.org/t/using-postfix-with-discourse/153841 "2020-06-04T16:17:15Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![cmoi](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cmoi](https://meta.discourse.org/u/cmoi)
#### Post date: [June 4, 2020, 4:17pm UTC](https://meta.discourse.org/t/using-postfix-with-discourse/153841/1 "2020-06-04T16:17:15Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [June 4, 2020, 4:33pm UTC](https://meta.discourse.org/t/using-postfix-with-discourse/153841/2 "2020-06-04T16:33:38Z")

</div>

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

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

---

<div class="post-metadata">

### Author: ![cmoi](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cmoi](https://meta.discourse.org/u/cmoi)
#### Post date: [June 4, 2020, 4:44pm UTC](https://meta.discourse.org/t/using-postfix-with-discourse/153841/3 "2020-06-04T16:44:38Z")

</div>

I tried every configuration in the book.

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

```plaintext
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.

```plaintext
  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?

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [June 4, 2020, 5:11pm UTC](https://meta.discourse.org/t/using-postfix-with-discourse/153841/4 "2020-06-04T17:11:46Z")

</div>

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

> [@cmoi](#):
>
> What are you guys using as an smtp server?

I find [mandrillapp.com](http://mandrillapp.com) and [mailgun.com](http://mailgun.com) to be pretty solid.

---

<div class="post-metadata">

### Author: ![cmoi](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cmoi](https://meta.discourse.org/u/cmoi)
#### Post date: [June 4, 2020, 5:56pm UTC](https://meta.discourse.org/t/using-postfix-with-discourse/153841/5 "2020-06-04T17:56:05Z")

</div>

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

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [June 4, 2020, 10:08pm UTC](https://meta.discourse.org/t/using-postfix-with-discourse/153841/6 "2020-06-04T22:08:54Z")

</div>

> [@cmoi](#):
>
> Don’t see where the config is wrong

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?

---

<div class="post-metadata">

### Author: ![cmoi](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cmoi](https://meta.discourse.org/u/cmoi)
#### Post date: [June 5, 2020, 1:34am UTC](https://meta.discourse.org/t/using-postfix-with-discourse/153841/7 "2020-06-05T01:34:08Z")

</div>

I actually gave up and took Amazon SES instead.

---

<div class="post-metadata">

### Author: ![discourse\_altha](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@discourse\_altha](https://meta.discourse.org/u/discourse_altha)
#### Post date: [July 14, 2020, 3:06pm UTC](https://meta.discourse.org/t/using-postfix-with-discourse/153841/8 "2020-07-14T15:06:05Z")

</div>

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

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 14, 2020, 3:10pm UTC](https://meta.discourse.org/t/using-postfix-with-discourse/153841/9 "2020-07-14T15:10:54Z")

</div>

> [@discourse\_altha](#):
>
> Any guidance on where I need to look/troubleshoot next?

Yes. Follow the [Discourse official Standard Installation](https://meta.discourse.org/t/discourse-official-standard-installation/142537) 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).
