How to get Discourse to work with Postfix

Hello. I have a discourse without a docker on my local server. Also installed iRedMail. First I tried to use an smtp-server from Test messages were sent, as well as invitations. But no email notifications came in, and the password was reset. I decided that I should install my local mail server and see the logs there why messages do not leave. I did. Local messages come between mailboxes. That’s what you need for testing. Thought it would be enough for local discourse and mail. Set your local smtp server. Sent a test email… and it got there! Winner(no). Looked at /var/log/mail.log of the mail server.

Okay. Now I’m sending an invitation to the same box… Looking at the mail server logs… …and nothing. It’s empty. I don’t know what the problem is.

All I’m asking is a “how-to” get discourse to speak to postfix.

Right now I have an active admin account by manually enabling it cause, you guessed it, I didn’t get the verification email. I’ll provide any files such as settings and logs upon request.

Dear @Anv

Welcome to Discourse Meta.

Normally when we have these kind of problem we run something like:

sendmail -vvv A_VALID_EMAIL_ADDRESS < email.txt

and this will give you a very verbose output of the handshake between you and the SMTP server; and normally that verbose logging will provide you the clues to solve your issue.

Hope this helps.

1 Like

Hi! I don’t have much experience. Installed dicsourse and a mail server for the first time. Could you elaborate on what exactly I need to do? Thank you.

Hey @Anv

First, you need to temporarily “forget” about Discourse, and focus on getting your SMTP mail relay up and running, tested and to make sure it can relay mail.

Have you done that part already?

1 Like

I installed iRedMail using this link.

Without a step 5 and 9.

Hey @Anv

That’s an advanced install for sure.

Did you test it without discourse and insure it is working?

Something like:

sendmail -vvv A_VALID_EMAIL_ADDRESS < email.txt


I made 2 mailboxes in my local domain “”. And the messages are coming to each other. To gmail/mail/yandex boxes, the messages don’t reach each other. I didn’t set it up, because I thought I could have enough intra-local communication for the tests.

@Anv Let me be blunt: A good unwritten rule should be something like “don’t ask people to talk to you if you’re not willing to put the effort to listen to them”. By “listening”, I mean considering what they’re telling you. Participating to a forum counts as “asking people to talk to you”, I guess. Especially if you’re asking for help.

Keeping on repeating the same thing, and forcing your interlocutor to also repeat himself doesn’t lead anywhere. For anyone.

Now, why have you not run this command line already ?

I’m sorry. But I guess I didn’t fully understand what was required of me. I did everything right?

Hey @Anv

I understand your frustration; and I’m sorry I don’t have more free time to debug all your SMTP relay problem every time you reply.

It seems like your SMTP mail host is receiving mail; but that does not necessarily mean it will work as an SMTP relay.

I recall, off the top of my head, there is a flag to use sendmail and other mail clients to check if the SMTP host is working properly as a relay. You might do some research on the sendmail -G option (or look for another way to test). Basically, you need to send the mail to a test email address different than the host you are working on, using your newly minted SMTP host as a relay.

Some History

In the old days, most SMTP hosts would relay mail out-of-the-box; but then all the SMTP hosts on the net became big SPAM boxes because spammers would just exploit the relay functionality (unknown to the owner of the box) and spam the world.

The bottom line is that you need to check to see if your newly minted SMTP host can relay the mail for you.

Did you look closely at your configuration tutorial and see if it mentioned setting up the SMTP host as a relay?

I’m just thinking out loud and hope this helps you in some small way get to the next step in your SMTP host project.

Okay, I think I hear you. I’m gonna see if I can find out any information on this.

1 Like

You mentioned you have Discourse installed without Docker. Would it possible for you to do a fresh new install the “classic” way (with docker) by entering the email you created during this new install ? Or you can’t run docker on the machine you’re using ?

1 Like

I tried with the docker, but there was no mail at all. I couldn’t even create an administrator account. I decided to expel the docker because I was inexperienced.

Hi @Mevo and @Anv

Good morning.

I’m sure it is not helpful, but as “just another datapoint”, I have never had any problem setting up SMTP mail on Discourse in either a Docker-based production install or a desktop macOS “no Docker” dev setup; but I have always used a third-party SMTP service.

You guys are getting my attention; and so now I am very interested in this little puzzle and will try to find time in the next few weeks to set up an SMTP relay on a VPS Ubuntu Linux slice and see if I can get Discourse to play ball with an “old fashioned” SMTP relay versus depending on “third party solutions”.

My apology in advance if it takes me a few weeks to build this configuration. I am falling behind on a bunch of boring government paper work because I have been having too much fun with learning Discourse plugin dev and how Rails works with all the moving parts.

1 Like

Hi @neounix.

Anyway, thank you so much for helping me with this.

Perhaps my main problem is that I want to run this inside a LAN without access from an external network.

Discourse log during invitation sending

Log says there’s a letter with an ID.
Tried to find a mention of this ID
1 ID - test message.
2 ID - invitation