# Mailgun sometimes does not send mail

**URL:** https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066
**Category:** Support
**Created:** [August 28, 2019, 9:28pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066 "2019-08-28T21:28:45Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![verilog15](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@verilog15](https://meta.discourse.org/u/verilog15)
#### Post date: [August 28, 2019, 9:28pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/1 "2019-08-28T21:28:45Z")

</div>

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

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/7/e7da460ffa761d7e600fa0b26abe6ffcb641dfbe.png)

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.

---

<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: [August 28, 2019, 9:40pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/2 "2019-08-28T21:40:57Z")

</div>

Check your mailgun logs.

---

<div class="post-metadata">

### Author: ![verilog15](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@verilog15](https://meta.discourse.org/u/verilog15)
#### Post date: [August 28, 2019, 9:44pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/3 "2019-08-28T21:44:57Z")

</div>

> [@pfaffman](#):
>
> your mailgun lo

Thanks for the fast reply 🙂  
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?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [August 30, 2019, 5:50am UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/4 "2019-08-30T05:50:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![verilog15](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@verilog15](https://meta.discourse.org/u/verilog15)
#### Post date: [August 30, 2019, 9:47am UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/5 "2019-08-30T09:47:41Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [August 30, 2019, 9:53am UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/6 "2019-08-30T09:53:41Z")

</div>

Are you typing `talnet`?

---

<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: [August 30, 2019, 10:14am UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/7 "2019-08-30T10:14:40Z")

</div>

What do you see at /sidekiq?

Have you rebooted lately?

---

<div class="post-metadata">

### Author: ![verilog15](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@verilog15](https://meta.discourse.org/u/verilog15)
#### Post date: [August 30, 2019, 1:05pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/8 "2019-08-30T13:05:07Z")

</div>

> [@fzngagan](#):
>
> Are you typing `talnet` ?

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

> [@pfaffman](#):
>
> What do you see at /sidekiq?
> 
> Have you rebooted lately?

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.

---

<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: [August 30, 2019, 1:09pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/9 "2019-08-30T13:09:46Z")

</div>

It’s

```
telnet 

```

Not talnet

---

<div class="post-metadata">

### Author: ![verilog15](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@verilog15](https://meta.discourse.org/u/verilog15)
#### Post date: [August 30, 2019, 2:13pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/10 "2019-08-30T14:13:13Z")

</div>

> [@itsbhanusharma](#):
>
> telnet [smtp.mailgun.com](http://smtp.mailgun.com)

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

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/d/ad285859f4dd80f0f48424b964f5b591ee4e8fc6.png)

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

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [August 30, 2019, 6:54pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/11 "2019-08-30T18:54:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![verilog15](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@verilog15](https://meta.discourse.org/u/verilog15)
#### Post date: [August 30, 2019, 7:01pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/12 "2019-08-30T19:01:13Z")

</div>

I the logs I have:

![image](https://global.discourse-cdn.com/meta/optimized/3X/6/3/63af0be18ddb77bd3d0fcb6658ab7f1efeda8d48_2_690x31.png)

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 🙂

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [August 30, 2019, 7:24pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/13 "2019-08-30T19:24:42Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![verilog15](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@verilog15](https://meta.discourse.org/u/verilog15)
#### Post date: [August 30, 2019, 7:44pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/14 "2019-08-30T19:44:32Z")

</div>

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

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/4/14ecd86613f22224a21f096902adffe6bbd7f046.png) )

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?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [August 30, 2019, 8:17pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/15 "2019-08-30T20:17:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![verilog15](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@verilog15](https://meta.discourse.org/u/verilog15)
#### Post date: [August 30, 2019, 8:36pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/16 "2019-08-30T20:36:23Z")

</div>

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 😅  
Thank you all for the help 🙂

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [September 29, 2019, 8:36pm UTC](https://meta.discourse.org/t/mailgun-sometimes-does-not-send-mail/127066/17 "2019-09-29T20:36:27Z")

</div>

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