Can't send mail on 16.04 - DigitalOcean

AI-generated summary

The user Jack_Spangenberg is experiencing issues sending mail on a Discourse installation on a DigitalOcean 16.04 droplet using NameCheap’s private email server. Despite the Discourse log showing ‘Mail Sent’, emails are not being delivered. Initial attempts to use port 2525 failed due to connection refusal, and port 587 works but may be blocked by DigitalOcean. The user also encountered Redis connection errors in the logs, which may be unrelated. After trying a configuration guide, the user received four duplicate emails, possibly from previous attempts. pfaffman suggests checking the remote mail server logs or spam folder, as the mail is being accepted but not delivered.

I’ve been looking for the answer all day, nothing.

  • I’m doing a fresh install via the first rails app guide on github.
  • Using a 1GB DigitalOcean droplet
  • Using NameCheap’s private email server.

Here is my app.yml:

DISCOURSE_HOSTNAME: smocks.me

  ## 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: '*****@gmail.com'

  ## 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: mail.privateemail.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: admin@***.me
  DISCOURSE_SMTP_PASSWORD: "*****"
  #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

Would appreciate any help on this.
P.S. I ran the more command on my Discourse log, it says Mail Sent!

It happened to me, and I set the port to 2525.

Didn’t work. Before I even checked the log I did telnet mail.privateemail.com 2525 and I got hit with:

telnet: Unable to connect to remote host: Connection refused

Also ran sudo ufw allow 2525/tcp @Mecanicos_Argentinos

Don’t DO block port 25 on new accounts now?

Afaik Mailgun on a secure port is still fine, otherwise you’ll need to contact support.

Can you telnet to port 587 of mail.privateemail.com? If not, you’ll need to open a ticket with Digital OCean to get them to unblock the port, or get mail.privateemail.com to accept connections at port 2525.

Port 587 works. I contacted DO about this a few hours ago, havent heard anything. This has happened with multiple VPS hosts.

Oops. I didn’t notice this before.

You need to check the logs at mail.privateemail.com, as it’s accepting mail from Discourse but not delivering it.

Or it’s in SPAM.

Tried this tutorial

Got this nasty mess:

Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) subscribe fail
ed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby
/2.4.0/gems/redis-4.0.1/lib/redis/client.rb:344:in `rescue in establish_connecti
on'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-4.0.1/lib/redis/cl
ient.rb:328:in `establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2
.4.0/gems/redis-4.0.1/lib/redis/client.rb:99:in `block in connect'", "/var/www/d
iscourse/vendor/bundle/ruby/2.4.0/gems/redis-4.0.1/lib/redis/client.rb:291:in `w
ith_reconnect'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-4.0.1/l
ib/redis/client.rb:98:in `connect'", "/var/www/discourse/vendor/bundle/ruby/2.4.
0/gems/redis-4.0.1/lib/redis/client.rb:363:in `ensure_connected'", "/var/www/dis
course/vendor/bundle/ruby/2.4.0/gems/redis-4.0.1/lib/redis/client.rb:219:in `blo
ck in process'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-4.0.1/l
ib/redis/client.rb:304:in `logging'", "/var/www/discourse/vendor/bundle/ruby/2.4
.0/gems/redis-4.0.1/lib/redis/client.rb:218:in `process'", "/var/www/discourse/v
endor/bundle/ruby/2.4.0/gems/redis-4.0.1/lib/redis/client.rb:118:in `call'", "/v
ar/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-4.0.1/lib/redis.rb:889:in `
block in get'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-4.0.1/li
b/redis.rb:45:in `block in synchronize'", "/usr/local/lib/ruby/2.4.0/monitor.rb:
214:in `mon_synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/red
is-4.0.1/lib/redis.rb:45:in `synchronize'", "/var/www/discourse/vendor/bundle/ru
by/2.4.0/gems/redis-4.0.1/lib/redis.rb:888:in `get'", "/var/www/discourse/vendor
/bundle/ruby/2.4.0/gems/message_bus-2.1.4/lib/message_bus/backends/redis.rb:285:
in `process_global_backlog'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/
message_bus-2.1.4/lib/message_bus/backends/redis.rb:321:in `block in global_subs
cribe'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.4/lib
/message_bus/backends/redis.rb:334:in `global_subscribe'", "/var/www/discourse/v
endor/bundle/ruby/2.4.0/gems/message_bus-2.1.4/lib/message_bus.rb:530:in `global
_subscribe_thread'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_b
us-2.1.4/lib/message_bus.rb:478:in `block in new_subscriber_thread'"]
Job exception: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)

It says “Mail Sent” 4 times at the bottom of my log.
Here is my complete config:
https://hastebin.com/egorawayif.bash
@pfaffman

Uh Ok. I got the email… but I got 4 of them? Could this be from previous tries