Mailgun sometimes does not send mail

Hi guys, it’s me again :slight_smile:
I noticed that when new users are signing up our forum, they sometimes don’t get an email.

In the following image, you can see that some users where registered 3 days ago and even 7 days ago but didn’t get an email for registration (The red box says “last time the mail was sent”).

I know that the email configuration is set properly because I can get emails (for example I can test it by clicking on “forgot password” and it will send me an email with the instructions). I’m aware that Mailgun is a different company but I’m not sure that it’s coming from them. What could the issue?

EDIT: I also tried now to register myself and it says that discourse sent me a registration email but I don’t have it in my mailbox (checked every folder, spam, and bin). I also tried to check in mails->sent in the admin area and did not see “signup” for this user. Please help because it look like new users can register to our forum.

1 Like

Check your mailgun logs.

Thanks for the fast reply :slight_smile:
I checked the logs, no sign about even trying to send the registration email. That why I though it could be an issue coming from discourse (maybe it fails to ask mailgun to send the mail?). Any ideas maybe?

Are you sure that your Server hosting provider isn’t blocking the port that you use for emails?

Some providers (including digitalocean) are known to block ports 25, 465, 587 to prevent spam from new servers. If you’re suffering this issue, maybe try using mailgun with port 2525 (change port in app.yml and rebuild)

an easy way to check if your port is blocked is to use telnet command
telnet smtp.mailgun.com <port>

1 Like

Thank you for your reply.
Unfortunately, I don’t have talnet installed. I tried to change the port to 2525 (from 587) but it looks like it still does not send signup mails. I do use digitalocean and I saw that it could be a problem but if they block it, shouldn’t Discourse write it in admin->mail logs in the failed section?

Are you typing talnet?

3 Likes

What do you see at /sidekiq?

Have you rebooted lately?

I did. I also tried which talnet but it returns nothing. (Isn’t it a Linux command beside been a protocol?)

I tried to look into /sidekiq (I saw that suggestion from similar threads). No fails and no mentions about trying to send an activation mail. I did reboot lately, I tried to switch the mail port to 2525 as was suggested before.

It’s

telnet 

Not talnet

1 Like

Oh, I’m sorry, such a stupid mistake :sweat_smile:
It looks like they are both valid:
image

So it’s not a problem of digitalocean or mailgun right?.

2 Likes

Neither it proves to be a problem from Discourse.
Can you check example.com/logs to see if there is something specific to emails? Also check /sidekiq to see if there are failing jobs

I the logs I have:

Don’t think they are related to the mail issue but if someone maybe knows how to solve them, I would love to hear.
In sidekiq I don’t see any failed or dead jobs.
By the way, just wanted to say thanks to all, for the trying to help :slight_smile:

It seems odd and I really can’t think of a reason. Can you see the mails going through in the mailgun logs? Do other mails work fine? Can you send discourse test mail to such email addresses without a problem?

The only mails that I can see that are sent are:

)

The last automatic summary report was sent to me two days ago (we are a small forum for now so not alot of mails).
I tried now to test sending this report to me and it does send me the summary mail (by the way, it will send the summary mail only to the admin right? because I tried a regular user, and it didn’t work).
Is there a way to send a test mail to non-admin mail?

Aha! I can see the problem here!

Have You limited the site setting disable_emails

If it is set to Yes or Staff-Only then You’re nuking emails on discourse side so they essentially Don’t trigger for anyone except the existing staff members.

3 Likes

Yes, that’s it!
I have not thought about it (maybe because my settings are written in half English half Hebrew).
That is the right answer. Perfect, it works now :sweat_smile:
Thank you all for the help :slight_smile:

1 Like

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