# Can't send mail on 16.04 - DigitalOcean

**URL:** https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852
**Category:** Self-hosting
**Created:** [5 mei 2018 om 21:46 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852 "2018-05-05T21:46:44Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Jack\_Spangenberg](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@Jack\_Spangenberg](https://meta.discourse.org/u/Jack_Spangenberg)
#### Post date: [5 mei 2018 om 21:46 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852/1 "2018-05-05T21:46:44Z")

</div>

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

```plaintext
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`!

---

<div class="post-metadata">

### Author: ![Mecanicos\_Argentinos](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@Mecanicos\_Argentinos](https://meta.discourse.org/u/Mecanicos_Argentinos)
#### Post date: [5 mei 2018 om 21:53 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852/2 "2018-05-05T21:53:10Z")

</div>

> [@Jack\_Spangenberg](#):
>
> 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.

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

---

<div class="post-metadata">

### Author: ![Jack\_Spangenberg](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@Jack\_Spangenberg](https://meta.discourse.org/u/Jack_Spangenberg)
#### Post date: [5 mei 2018 om 22:12 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852/3 "2018-05-05T22:12:01Z")

</div>

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

```Trying
telnet: Unable to connect to remote host: Connection refused

```

---

<div class="post-metadata">

### Author: ![Jack\_Spangenberg](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@Jack\_Spangenberg](https://meta.discourse.org/u/Jack_Spangenberg)
#### Post date: [5 mei 2018 om 22:12 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852/4 "2018-05-05T22:12:54Z")

</div>

Also ran `sudo ufw allow 2525/tcp` @Mecanicos_Argentinos

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [5 mei 2018 om 23:08 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852/5 "2018-05-05T23:08:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [5 mei 2018 om 23:08 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852/6 "2018-05-05T23:08:58Z")

</div>

Can you telnet to port 587 of [mail.privateemail.com](http://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](http://mail.privateemail.com) to accept connections at port 2525.

---

<div class="post-metadata">

### Author: ![Jack\_Spangenberg](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@Jack\_Spangenberg](https://meta.discourse.org/u/Jack_Spangenberg)
#### Post date: [5 mei 2018 om 23:13 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852/7 "2018-05-05T23:13:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [5 mei 2018 om 23:15 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852/8 "2018-05-05T23:15:12Z")

</div>

> [@Jack\_Spangenberg](#):
>
> P.S. I ran the `more` command on my Discourse log, it says `Mail Sent` !

Oops. I didn’t notice this before.

You need to check the logs at [mail.privateemail.com](http://mail.privateemail.com), as it’s accepting mail from Discourse but not delivering it.

Or it’s in SPAM.

---

<div class="post-metadata">

### Author: ![Jack\_Spangenberg](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@Jack\_Spangenberg](https://meta.discourse.org/u/Jack_Spangenberg)
#### Post date: [6 mei 2018 om 01:50 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852/9 "2018-05-06T01:50:10Z")

</div>

Tried [this](https://meta.discourse.org/t/solution-for-privateemail-configurations/71561) tutorial

Got this nasty mess:

```plaintext
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](https://hastebin.com/egorawayif.bash)  
@pfaffman

---

<div class="post-metadata">

### Author: ![Jack\_Spangenberg](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@Jack\_Spangenberg](https://meta.discourse.org/u/Jack_Spangenberg)
#### Post date: [6 mei 2018 om 01:50 UTC](https://meta.discourse.org/t/cant-send-mail-on-16-04-digitalocean/86852/10 "2018-05-06T01:50:41Z")

</div>

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