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 mail.ru. 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.

image

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.

Likely whats happening is your emails are being returned as undeliverable.

How and where can I be sure of that? Why isn’t it in the mail server logs? How can I fix it?

You can test it by logging into the email used to send with an email client and watching the inbox for undeliverables. Mail being undeliverable isnt an issue with the mail server necessarily. You could have issues with your DNS that the receiving server doesnt like. If you dont have SPF and DKIM records, some servers will just outright reject all email from your domain.

I used this tutorial to get my email server set up before setting up my discourse instance. Its required that you get email working first (for reasons that are obvious to you now).

But do I need it for local work and mail server and disсcourse? I am new to these questions, I am installing for the first time.

You need a fully working email server for discourse to work properly. You cant just hand it an SMTP server because your user account gets tied to the email used to send notifications. You also need access to that for adding admins later.

If you’ll excuse me, maybe I don’t fully understand you. But isn’t my server running now? I have access to mail, I can exchange messages between mail server boxes.

can you send an email to an account that isnt on your server?

No. Only within my local network.

You should go into more detail about how you set discourse up and how you intend to use it.

Discourse connects to your SMTP the same way any email client would. This info is in /var/discourse/containers/app.yml

If you cant connect with an email client then neither can discourse.

Without a docker. SMTP settings here.

Theres not enough information here to help you.

Sorry. I’m going to have to say I cant help you.

I can give you any information you need. Just tell me exactly what you need.

Are discourse.ugda.space and mail.ugda.space the same host?

discourse.ugda.space hostname server from discourse.
Mail.ugda.space hostname of the mail server.

I get that they are different names, do they point to the same computer?

These are different virtual servers and different IP addresses.

Then my guess if there is no record of your discourse emails showing up in the postfix logs is either:

  1. the discourse host does not know how to resolve the address for mail.ugda.space;

  2. or your postfix instance is not using the submission process (port 587) but is instead using the smtp process (port 25) for incoming user emails to be sent.

The hostname is pinged from the disсourse server.
I understand port 25 is open.
image

image

You’re not asking discourse to connect to gmail-smtp-in.l.google.com on port 25.

You are asking discourse to mail.ugda.space on port 587 and expecting postfix to be listening. But the default postfix configuration does not listen on port 587 for client emails. By default, postfix listens on port 25 for both mail transfers and client submissions.

Did you set postfix to listen on port 587?