Trouble sending emails


I was trying to send email after an email server switch, before it was working fine, however, now I am unable to send emails. The thing is, the connection is 100% working as you can see. But for some reasons it is unable to send the email.

Email address for mail test? ('n' to skip) []:
Sending mail to . .
Testing sending to using, with login auth.
SMTP server connection successful.
Sending to . .
Sending mail failed.
end of file reached

Any suggestions?

Check your VPS hosting provider has unlocked the SMTP port (although the connection appears to have been confirmed) … check your email service logs too for evidence of the request.

1 Like

It running on my Raspberry like it always did. But yeah, the connection is good. I will check with Zoho.

I’ve seen that “end of file” message before but don’t remember what the resolution was. You might find it if you search here.

There shouldn’t be any solution for this really. Why would I need to modify anything, if the connection was successful?

Also, yes, I found several topics like that, also one thread where you replied, but I am not going to fallback to 465 port which is depricated. Obviously, the issue is with Discourse or its Mail Sending library.

Do you mind sharing your redacted app.yml? I believe something is absent from your SMTP section or misconfigured.

1 Like

I can share, but how would it be misconfigured if the connection was successful?

## this is the all-in-one, standalone Discourse Docker container template
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
## visit to validate this file as needed

  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
#  - "templates/web.ssl.template.yml"
#  - "templates/web.letsencrypt.ssl.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see for details
  - "8080:8080"   # http
  - "15432:5432" # PostgreSQL
#  - "8443:8443" # https

  db_default_text_search_config: "pg_catalog.english"

  ## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  #db_shared_buffers: "256MB"

  ## can improve sorting performance, but adds memory usage per-connection
  #db_work_mem: "40MB"

  ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed

  LC_ALL: en_US.UTF-8
  LANG: en_US.UTF-8

  ## How many concurrent web requests are supported? Depends on memory and CPU cores.
  ## will be set automatically by bootstrap based on detected CPUs, or you can override

  ## TODO: The domain name this Discourse instance will respond to
  ## Required. Discourse will not work with a bare IP number.

  ## Uncomment if you want the container to be started with the same
  ## hostname (-h option) as specified above (default "$hostname-$config")

  ## TODO: List of comma delimited emails that will be made admin and developer
  ## on initial signup example ','

  ## TODO: The SMTP mail server used to validate new accounts and send notifications
  # SMTP ADDRESS, username, and password are required
  # WARNING the char '#' in SMTP password can cause problems!
  DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate

  ## The http or https CDN address for this Discourse instance (configured to pull)
  ## see for details

  ## The maxmind geolocation IP address key for IP address lookup
  ## see for details

## The Docker container is stateless; all data is stored in /shared
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

## Plugins go here
## see for details
    - exec:
        cd: $home/plugins
          - git clone
          - git clone
          - git clone
          - git clone
          - git clone
          - git clone

## Any custom commands to run after building
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  #- exec: rails r "SiteSetting.notification_email=''"
  - exec: echo "End of custom commands"

does have the proper configuration to send emails as ?

This needs to be verified at your SMTP provider’s end.


I will try something and let you guys know.

Thank you Bhanu, I didn’t pay enough attention on this, I hate Zoho’s settings because they hide these options too much.

1 Like

The good news is you didn’t spend 5 days debugging the smtp library as you suggested!

(I just spent a dozen hours over many days recently debugging the code that inserted a pull down menu that wouldn’t pull down. I poured over the coffee that inserted the pull down. I examined the coffee that produced the data for the pull down. I compared it to how other pull downs worked. Then, I found one little line of css that I had inserted that had made it so that there was no space for the pull down to pull down into.)

Glad you got it working!


I mean, it’s still at least could check and output a better error, because this is really confusing.

That’s why the standard install includes a list of recommended mail providers. If you want to deviate from those recommendations then you also accept the additional technical complexity that it introduces. Not all mail servers behave the same, it’s not the place of Discourse to address that.

The summary of the above is you misconfigured Zoho. Discourse can’t see the configuration there, and assumes you’re providing it with correct info. Had you rerun ./discourse-setup, it would have asked you again for the sending address, which you would have entered incorrectly due to this misconfiguration.

We can save users from a lot of problems, but rarely from themselves. Next time around I would suggest focusing on the more likely aspects and double-checking the details on external systems, before insisting that the issue lies in code that’s being utilized to serve tens of millions of users. It will likely get you to your answer far quicker.

You are right, but again, you could also mention this in the email troubleshooting guide, even if this is a pretty self-explanatory step thing to do before configuring Discourse.

Either way, I am thankful to the guys above for the help.

That would be great.

But, it’s not clear that “end of file reached” will always mean, “you failed to configure your mail service for the sending address that you used” or whatever it was they you did to fix things.

It turns out that there are lots of things to do wrong after discourse successfully connects to a mail server. If you want a better error message, have zoho provide one rather than just shut down the connection.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.