Discourse מתחבר לשרת ה-SMTP אך נכשל בשליחת דוא"ל דרכו

סיכום מבוסס בינה מלאכותית

User superman reports that Discourse connects successfully to the SMTP server (mail.forum.domainname.com on port 587) but fails to send registration emails, despite exim4 working independently and no errors in its logs. pfaffman suggests checking mail server logs and configuring exim4 properly, noting potential issues with sender address validity or domain mismatch. DBHacker asks if the container was rebuilt and advises checking SMTP environment variables via the Rails console. superman confirms credentials and rebuild were correct, questioning whether the SMTP address should include “mail” and whether Discourse’s sending hostname is causing the issue. pfaffman suspects a mismatch between the forum hostname and the mail server’s expected domain. superman seeks clarification on Discourse’s actual sending hostname. codinghorror clarifies that by default, Discourse uses email@forum.somedomain.com, which often trips users expecting email@somedomain.com. The core issue appears to be domain or sender address configuration mismatches between Discourse and the mail server.

Cant get the first user registration email:

Discourse doctor says:
SMTP server connection successful.
Sending mail failed.

However:
Telnet to mail.domain.com port 587 works and EHLO mailserver command works.

How can I fix this, any help would be greatly appreciated.

You might look at the mail server logs. Whatever error it is isn’t sometime that v Discourse-doctor understands.

You’ll need to Google how to configure exim4.

From 7. The default configuration file

Freezing occurs when a bounce message encounters a permanent failure because the sender address of the original message that caused the bounce is invalid, so the bounce cannot be delivered.

My guess is that you need to change the notification email address or configure exim to use your subdomain

Did you forget to rebuild your container?

Anyway, you can check your container by:

docker exec -it app rails c

Then, from the rails console:

[1] pry(main)>ENV

You can look at all your SMTP environmental variables easily.

Exim4 was tested to verify it sends and receives emails.
Discourse was rebuilt with discourse-setup, using all the correct credentials:

Hostname      : forum domainname com
Email         : user@test com
SMTP address  : mail forum domainname com
SMTP port     : 587
SMTP username : postmaster@forum domainname com
SMTP password : password

Then, discourse-doctor is run to test weather Discourse can send email from the local exim4 mail server.

Discourse-doctor says:
“SMTP server connection successful.”
“Sending mail failed.”

However, there are no errors in the exim4 log.

Why does sending mail fail?
Is this a common problem?

Notice that the SMTP address is: mail forum domainname com,
should it have “mail” at the beginning?

Discourse-doctor says that Discourse does connect to:
mail forum domainname com,
but Discourse does not send the email.

My guess is a mismatch between your forum host name and the domain name that the mail server will send for.

What is the hostname that Discourse uses to send mail?
Does it use forum.somedomain.com?
or
Does it use mail.forum.somedomain.com?

By default it is email@forum.somedomain.com as I recall.

This trips some people up because they expect it to be

email@somedomain.com