How to get Discourse to work with Postfix

image

As I understand it, the postfix is listening to port 587?

What do the discourse logs say when you try to send an email invitation?

That last line is delivered mail MESSAGE-ID. That sounds like your discourse instance thinks it successfully completed an smtp conversation with the mail server. Are you sure postfix has nothing in its logs?

/var/log/maillog

I was the one who tried to send a test message from the discourse on port 25. And then he returned port 587 and sent out an invitation.

From your postfix log’s it looks like discourse connected but never authenticated, does your postfix config require authentication before sending mail or is it an “open relay”?

Do you have postfix setup as the MDA or is it handing off mail through lmtp or lda to a separate server like dovecot for delivery?


This is a log when you send a test message. I take it I have a dovecot.

I can’t attach the link that I’ve been setting up the mail server.

It looks like discourse is successfully connecting to postfix, authenticating as [email protected], completing the smtp transaction, but then postfix is not immediately handing the received mail to dovecot. Postfix is instead queuing the mail, and then connecting to itself to relay the queued mail, but this time the “internal relay” hands the message off to dovecot to deliver to [email protected]’s inbox.

Is that more or less what you are trying to do? Have discourse use [email protected] send an invitation to [email protected]?

If so, where do you have dovecot set to store received mail?

Yeah, I want the discourse to use [email protected] to send out invitations and other emails.

If I understood you correctly, I installed the MariaDB database.

I am asking where [email protected]’s inbox is on the filesystem. In your dovecot config, there is a mail_location option. It’s probably in one of the numerous files in /etc/dovecot/conf.d.

A typical setting would look like mail_location = maildir:/var/mail/vmail/%d/%n/mail:LAYOUT=fs

so emails would be stored at /var/mail/vmail/ugda.space/test/mail.

Hopefully when you look at wherever mail_location points to, you see all the sent invitations.

edit: you can probably use the command doveconf -n | grep mail_location to find its value quicker than looking through the config files.

image

I found the last email that’s on [email protected] is a test message from the discourse.

Are none of the invitations emails in there?

No

In your discourse log, the last line had Delivered mail MESSAGE-ID where the MESSAGE-ID was [email protected]. Can you find that specific message id in your mail logs so we can see what specifically happened with that email?

That MESSAGE-ID is not here.
/var/log/maillog

Looking at the time, there’s no action in the logs at this time interval.

1 ID - test message.
2 ID - invitation

What version of discourse are you using?

There is a thread https://community.bitnami.com/t/discourse-sending-test-emails-but-not-invitations-via-mailjet/50023/5 that fits your problem:

The test emails are recieved at the destination acct.
However, sending a Discourse invitation to the same address appears to succeed in the admin interface,
but the email is never receieved and there is no record of it passing through Mailjet in Mailjet’s Real-time Dashboard.

It looks like the problem was fixed in versions 1.7.10-r1.

Then I am out of ideas. Sorry.

Thank you so much for your help!

I know you said you weren’t using a docker image, but there are similar issues in some git repositories that share your issues: can send test email but other emails don't get sent.

The fixes seem to be change development to production in the config/sidekiq.yml file.

If you are at a dead end, that might be worth a shot.