Trouble sending emails

Hi.

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) [community@brohosting.eu]:
Sending mail to community@brohosting.eu. . .
Testing sending to community@brohosting.eu using smtppro.zoho.eu:587, username:info@brohosting.eu with login auth.
SMTP server connection successful.
Sending to community@brohosting.eu. . .
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
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed

templates:
  - "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 https://meta.discourse.org/t/17247 for details
expose:
  - "8080:8080"   # http
  - "15432:5432" # PostgreSQL
#  - "8443:8443" # https

params:
  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

env:
  LC_ALL: en_US.UTF-8
  LANG: en_US.UTF-8
  LANGUAGE: en_US.UTF-8
  EMBER_CLI_PROD_ASSETS: 1
  # DISCOURSE_DEFAULT_LOCALE: en

  ## 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
  #UNICORN_WORKERS: 3

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

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

  ## TODO: List of comma delimited emails that will be made admin and developer
  ## on initial signup example 'user1@example.com,user2@example.com'
  DISCOURSE_DEVELOPER_EMAILS: 'community@brohosting.eu'

  ## 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_ADDRESS: smtppro.zoho.eu
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: info@brohosting.eu
  DISCOURSE_SMTP_PASSWORD: "XXXXXXXXXXXX"
  DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)
  DISCOURSE_SMTP_DOMAIN: brohosting.eu
  DISCOURSE_SMTP_AUTHENTICATION: login
  DISCOURSE_NOTIFICATION_EMAIL: community@brohosting.eu

  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
#  LETSENCRYPT_ACCOUNT_EMAIL: info@brohosting.eu

  ## The http or https CDN address for this Discourse instance (configured to pull)
  ## see https://meta.discourse.org/t/14857 for details
  #DISCOURSE_CDN_URL: https://discourse-cdn.example.com

  ## The maxmind geolocation IP address key for IP address lookup
  ## see https://meta.discourse.org/t/-/137387/23 for details
  #DISCOURSE_MAXMIND_LICENSE_KEY: 1234567890123456

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

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-chat.git
          - git clone https://github.com/discourse/discourse-reactions.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-voting.git
          - git clone https://github.com/discourse/discourse-chat-integration.git


## Any custom commands to run after building
run:
  - 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='info@unconfigured.discourse.org'"
  - exec: echo "End of custom commands"

does info@brohosting.eu have the proper configuration to send emails as community@brohosting.eu ?

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

4 Likes

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!

3 Likes

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