# Unable to get SMTP function to work

**URL:** <https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882>\
**Category:** Help\
**Created:** [September 17, 2022, 8:22am UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882 "2022-09-17T08:22:02Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![BlackDex](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/blackdex/32/8_2.png) [@BlackDex](https://vaultwarden.discourse.group/u/BlackDex)\
**Post date:** [September 18, 2022, 11:49am UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/21 "2022-09-18T11:49:55Z")

</div>

Ok…  
What does this tell you??

```bash
docker exec vaultwarden nc -vz smtp.office365.com 587

```

---

<div class="post-metadata">

**Author:** ![matties02](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@matties02](https://vaultwarden.discourse.group/u/matties02)\
**Post date:** [September 18, 2022, 1:05pm UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/22 "2022-09-18T13:05:49Z")

</div>

root@vps8773:~# docker exec vaultwarden nc -vz [smtp.office365.com](http://smtp.office365.com) 587  
OCI runtime exec failed: exec failed: container\_linux.go:367: starting container process caused: exec: “nc”: executable file not found in $PATH: unknown

---

<div class="post-metadata">

**Author:** ![BlackDex](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/blackdex/32/8_2.png) [@BlackDex](https://vaultwarden.discourse.group/u/BlackDex)\
**Post date:** [September 18, 2022, 1:45pm UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/23 "2022-09-18T13:45:30Z")

</div>

> [@matties02](#):
>
> [smtp.office365.com](http://smtp.office365.com) 587

Of course, the debian image doesn’t have that there by default.  
In that case try this:  
You need to run this by starting a tty first, so:

```bash
docker exec -it vaultwarden bash

```

```bash
timeout 5 bash -c 'cat < /dev/null > /dev/tcp/smtp.office365.com/587'; echo $?

```

---

<div class="post-metadata">

**Author:** ![matties02](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@matties02](https://vaultwarden.discourse.group/u/matties02)\
**Post date:** [September 18, 2022, 1:47pm UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/24 "2022-09-18T13:47:33Z")

</div>

root@vps8773:~# timeout 5 bash -c ‘cat \< /dev/null \> /dev/tcp/smtp.office365.com/587’; echo $?  
124

---

<div class="post-metadata">

**Author:** ![BlackDex](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/blackdex/32/8_2.png) [@BlackDex](https://vaultwarden.discourse.group/u/BlackDex)\
**Post date:** [September 18, 2022, 1:50pm UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/25 "2022-09-18T13:50:14Z")

</div>

If I’m correct, you tested that from the host right, not from within the container.  
But that also gives the response we didn’t wanted to see.

the `124` response is the timeout being reached, and thus, it wasn’t able to connect to it from the host it self.

What if you try that `nc` command from the host?

---

<div class="post-metadata">

**Author:** ![matties02](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@matties02](https://vaultwarden.discourse.group/u/matties02)\
**Post date:** [September 18, 2022, 1:56pm UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/26 "2022-09-18T13:56:58Z")

</div>

from the docker image i get 124. and the nc command is not found in debian 11

---

<div class="post-metadata">

**Author:** ![BlackDex](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/blackdex/32/8_2.png) [@BlackDex](https://vaultwarden.discourse.group/u/BlackDex)\
**Post date:** [September 18, 2022, 2:03pm UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/27 "2022-09-18T14:03:50Z")

</div>

Ok, try the `timeout` command also on the host then.

```bash
timeout 5 bash -c 'cat < /dev/null > /dev/tcp/smtp.office365.com/587'; echo $?

```

Maybe increase the timeout a bit to 10 or 15.  
But if that doesn’t work on the host either then I’m afraid your VPS provider is blocking access to these ports.

Also try the following:

```bash
# Port 443 to office365
timeout 5 bash -c 'cat < /dev/null > /dev/tcp/smtp.office365.com/443'; echo $?

# Port 465 to sendgrid
timeout 5 bash -c 'cat < /dev/null > /dev/tcp/smtp.sendgrid.net/465'; echo $?

```

---

<div class="post-metadata">

**Author:** ![matties02](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@matties02](https://vaultwarden.discourse.group/u/matties02)\
**Post date:** [September 18, 2022, 2:16pm UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/28 "2022-09-18T14:16:43Z")

</div>

RIP, 443 on office works 587 not. same goes for sendgrid on the vps and the docker bash

---

<div class="post-metadata">

**Author:** ![BlackDex](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/blackdex/32/8_2.png) [@BlackDex](https://vaultwarden.discourse.group/u/BlackDex)\
**Post date:** [September 18, 2022, 2:18pm UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/29 "2022-09-18T14:18:31Z")

</div>

Then I think your VPS Provider is blocking that access.  
You might try to check there FAQ’s on this, maybe there is a way to ask if they unblock this somehow for specific hosts maybe?

They probably do this to prevent sending out spam from there network.

---

<div class="post-metadata">

**Author:** ![matties02](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@matties02](https://vaultwarden.discourse.group/u/matties02)\
**Post date:** [September 18, 2022, 2:38pm UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/30 "2022-09-18T14:38:12Z")

</div>

Just contacted the vps provider and yes they block the ports. they can enable them, so i will let you know if its fixed

---

<div class="post-metadata">

**Author:** ![matties02](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@matties02](https://vaultwarden.discourse.group/u/matties02)\
**Post date:** [September 19, 2022, 8:21am UTC](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882/31 "2022-09-19T08:21:20Z")

</div>

My VPS profider did block the ports, they have enabled it now, so everything works. Thank you very much for taking your time to help me figure this out.  
With kind regards,  
Mathijs

[Previous page](https://vaultwarden.discourse.group/t/unable-to-get-smtp-function-to-work/1882.md?page=1)
