Digital Ocean is blocking outgoing mail!


#1

I’m getting below error:

There was a problem sending the test email. Please double-check your mail settings, verify that your host is not blocking mail connections, and try again.

This is what I tried to do:
I removed my SendinBlue credentials and tried updating SendGrid/Mailgun SMTP credentials.
Both SendGrid and MailGun - not working. I’m getting the above error.
I remember using Mailgun initially (before I started using SendinBlue - and it worked like a charm)
So, I’m wondering why Mailgun isn’t working now.

I get the above error while trying to do a “send test email” from the admin panel.


(Jay Pfaffman) #2

It’s probably that you entered the wrong credentials or you have firewalled access to mailgun.


#3

@pfaffman

The credentials- are correct - I double checked it.
(I tried both SendGrid & Mailgun - neither of this works)

Regarding firewall - no there isn’t any firewall blocking things.
I remember - Mailgun working for me - with the exact same setup - (initially, when I first installed and started using discourse)


(Jay Pfaffman) #4

You can try to telnet to the port on mailgun from your host and see if it’ll connect. If not, something is blocking the connection.

When your try to send the test message, does it just wait for a long time and then fail?

I’ve had one client recently that can’t connect to mailgun either. I’ve not had a chance to debug it to discern if the problem is on the mailgun or digital ocean side.


#5

Here is my config:

DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: postmaster@mail.mydomain.com
DISCOURSE_SMTP_PASSWORD: “mypassword”
#DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true)
DISCOURSE_SMTP_AUTHENTICATION: “login”


#6

@pfaffman
Sure, as you’ve mentioned above, going to try telnet.


#7

@pfaffman

Yes - when I try to send a message - it just waits - for a long time - and then fails.


#8

@pfaffman
Telnet doesn’t seem to work.

root@mydomain:/var/discourse/containers# telnet smtp.mailgun.org 587
Trying 52.0.148.208…

Its still on that screen for more than 2 minutes now.


(Jay Pfaffman) #9

Something is blocking the connection. File a ticket with mailgun (with your host’s ip number) and perhaps with your hosting provider. Say that your can’t connect and that the connection times out.

Now that your have exposed your password you should change it (or maybe you did before sharing it).

If you get a solution, please let me know. It might help with my clients similarly mysterious problem.

Perhaps your host has been blacklisted. Find the ticket with mailgun, then search for blacklist checkers and see if your host is on one.


#10

@pfaffman
Sure - I will be contacting Mailgun on this right away.

I will be updating my progress here.


#11

@pfaffman

I tried telnet for SendinBlue also - it didn’t work for SendinBlue either. I’m using DigitalOcean Droplet - with Ubuntu OS (Docker setup). Are you sure telnet is supposed to work? I checked firewall - there is no firewall setup at OS side.

Little more background about my problem
The reason I’m trying to switch from SendinBlue to a different provider is because - they have recently reduced my sending limit. They have made it to 5 per hour from 300 per hour. I’ve created a ticket with them to look into this - this is not the first time their system is acting weird. But this time, I don’t want to stick with them again - I’m going to switch. Now, due to this - in my dashboard I can see “TONS and TONS of pending email jobs”

Now, I’m starting to think

  1. Is it the pending jobs that is causing issues here?

#12

Screenshot of Sidekiq:

(listting pending email jobs etc)


(Jay Pfaffman) #13

That’s all consistent with outgoing mail ports being blocked.

Digital ocean has some new firewall stuff that is controlled from the web interface, not at the os level. I’m wondering if it’s somehow enabled,or if it was enabled on that ip and then you got assigned the same ip, the mail ports are still filtered, but you’ve had this droplet for a while, right?


#14

@pfaffman
I think that is a GOOD idea.

This guy had a similar issue here:

His issue was that:
The host had blocked SMTP (just like you’ve posted above)

So, let me check - in DO- if SMTP is blocked by them or not.


#15

@pfaffman
Yes - I’ve had this droplet for 4+ months now.


#16

@pfaffman

Its not blocked at DO end:

All - outgoing ports - “both UDP+TCP” - allowed.


(Jay Pfaffman) #17

File a ticket with DO. That’s what I’m doing.


#18

@pfaffman
Sure.

ALSO:

Something that is really weird is this:

When I checked in admin panel, I can see that the last email was sent like 23 hours ago.
(When I checked in SendinBlue logs - I can see - emails were sent very recently too (max 5 an hour).


(Jay Pfaffman) #19

The admin panel might think that mail Discourse tried to send was sent.

It may be that Discourse queued mail for the old SendinBlue server and will continue trying to send it there even though you’ve changed. I don’t know for sure, though, and that does seem strange. Also, if SendinBlue is still receiving mail from Discourse, then the “all smtp ports are blocked” hypothesis doesn’t hold.


#20

Yes I don’t think SMTP is blocked.
Because - I can see from the SendinBlue logs that - emails were sent very recently.