[GH-ISSUE #1203] SMTP not connecting: SMTP IO error: Resource temporarily unavailable (os error 11) #848

Closed
opened 2026-03-03 02:03:54 +03:00 by kerem · 20 comments
Owner

Originally created by @jean-io on GitHub (Oct 28, 2020).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1203

Hello,

For some reason sending email with SMTP is not working with bitwarden_rs latest image. I get the following error in my log file: SMTP IO error: Resource temporarily unavailable (os error 11). My understanding is this error is caused by the host and not from the remote SMTP server.
No luck on troubleshooting this issue so far...

Environment

  • Bitwarden_rs version: 1.17.0
  • Install method: Docker (latest)
  • Clients used: web ui

Extract of my docker compose file:

version: "3"

services:
  bitwarden_rs:
    hostname: 'XXX-BITWARDEN-CONTAINER'
    container_name: bitwarden_xxx
    image: bitwardenrs/server:latest
    ports:
      - "127.0.0.1:8004:80/tcp"
    environment:
      DOMAIN: "https://xxx"
      SIGNUPS_ALLOWED: "false"
      DATABASE_URL: "mysql://bitwarden:xxx@xxx/xxx"
      ENABLE_DB_WAL: "false"
      SMTP_HOST: "xxx"
      SMTP_FROM: "xxx"
      SMTP_PORT: 465
      SMTP_SSL: "true"
      SMTP_USERNAME: "xxx"
      SMTP_PASSWORD: "xxx"
      #LOG_LEVEL: "warn"
    volumes:
      - '/etc/hosts:/etc/hosts'
      - './bw_data/:/data/'
    restart: unless-stopped

Relevant logs

[2020-10-28 13:56:49.011][request][INFO] POST /api/accounts/verify-email
[2020-10-28 13:57:09.604][bitwarden_rs::api::core::accounts][ERROR] Error sending delete account email: SMTP IO error: Resource temporarily unavailable (os error 11)
[2020-10-28 13:57:09.604][response][INFO] POST /api/accounts/verify-email (post_verify_email) => 200 OK
[2020-10-28 14:39:58.788][request][INFO] POST /api/organizations/XXX/users/XXX/reinvite
[2020-10-28 14:40:18.619][error][ERROR] SMTP IO error: Resource temporarily unavailable (os error 11)
[2020-10-28 14:40:18.619][response][INFO] POST /api/organizations/<org_id>/users/<user_org>/reinvite (reinvite_user) => 400 Bad Request
Originally created by @jean-io on GitHub (Oct 28, 2020). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1203 Hello, For some reason sending email with SMTP is not working with bitwarden_rs latest image. I get the following error in my log file: `SMTP IO error: Resource temporarily unavailable (os error 11)`. My understanding is this error is caused by the host and not from the remote SMTP server. No luck on troubleshooting this issue so far... ### Environment * Bitwarden_rs version: 1.17.0 * Install method: Docker (latest) * Clients used: web ui Extract of my docker compose file: ``` version: "3" services: bitwarden_rs: hostname: 'XXX-BITWARDEN-CONTAINER' container_name: bitwarden_xxx image: bitwardenrs/server:latest ports: - "127.0.0.1:8004:80/tcp" environment: DOMAIN: "https://xxx" SIGNUPS_ALLOWED: "false" DATABASE_URL: "mysql://bitwarden:xxx@xxx/xxx" ENABLE_DB_WAL: "false" SMTP_HOST: "xxx" SMTP_FROM: "xxx" SMTP_PORT: 465 SMTP_SSL: "true" SMTP_USERNAME: "xxx" SMTP_PASSWORD: "xxx" #LOG_LEVEL: "warn" volumes: - '/etc/hosts:/etc/hosts' - './bw_data/:/data/' restart: unless-stopped ``` ### Relevant logs ``` [2020-10-28 13:56:49.011][request][INFO] POST /api/accounts/verify-email [2020-10-28 13:57:09.604][bitwarden_rs::api::core::accounts][ERROR] Error sending delete account email: SMTP IO error: Resource temporarily unavailable (os error 11) [2020-10-28 13:57:09.604][response][INFO] POST /api/accounts/verify-email (post_verify_email) => 200 OK [2020-10-28 14:39:58.788][request][INFO] POST /api/organizations/XXX/users/XXX/reinvite [2020-10-28 14:40:18.619][error][ERROR] SMTP IO error: Resource temporarily unavailable (os error 11) [2020-10-28 14:40:18.619][response][INFO] POST /api/organizations/<org_id>/users/<user_org>/reinvite (reinvite_user) => 400 Bad Request ```
Author
Owner

@BlackDex commented on GitHub (Oct 30, 2020):

This error occurres when the mail server is not reachable or the dns could not be resolved. It can also mean that the port is incorrect for example.

Bitwardenrs can't connect to the mail server for some reason.

<!-- gh-comment-id:719090459 --> @BlackDex commented on GitHub (Oct 30, 2020): This error occurres when the mail server is not reachable or the dns could not be resolved. It can also mean that the port is incorrect for example. Bitwardenrs can't connect to the mail server for some reason.
Author
Owner

@jean-io commented on GitHub (Nov 6, 2020):

Well, I did more test... DNS resolution works inside this container. I tried with curl:

jean@nuc /opt/ship/bitwarden $ sudo docker exec -it bitwarden bash
root@BITWARDEN-CONTAINER:/# curl -i ssl0.ovh.net
HTTP/1.1 301 Moved Permanently
Content-length: 0
Location: https://www.ovh.co.uk/mail/
Connection: close

I have enabled DEBUG and here is the output (note that sending mail with the same credential work in other container):

[2020-11-06 13:49:57.384][request][INFO] POST /admin/test/smtp/
[2020-11-06 13:49:57.385][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url")))
[2020-11-06 13:49:57.385][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"])
[2020-11-06 13:49:57.385][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url")))
[2020-11-06 13:49:57.385][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"])
[2020-11-06 13:49:57.385][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url")))
[2020-11-06 13:49:57.385][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"])
[2020-11-06 13:49:57.385][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url")))
[2020-11-06 13:49:57.385][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"])
[2020-11-06 13:49:57.386][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url")))
[2020-11-06 13:49:57.386][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"])
[2020-11-06 13:49:57.386][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url")))
[2020-11-06 13:49:57.386][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"])
[2020-11-06 13:50:17.115][error][ERROR] SMTP IO error: Resource temporarily unavailable (os error 11)
[2020-11-06 13:50:17.116][response][INFO] POST /admin/test/smtp (test_smtp) => 400 Bad Request

My issue is very similar to https://bitwardenrs.discourse.group/t/smtp-unable-to-send-email/145.

This error occurres when the mail server is not reachable or the dns could not be resolved.

The error message is not really clear. For some reason there is no DEBUG message related to SMTP, I find it really strange... Any one that got this error has give up so far since SMTP work with gmail but not with custom SMTP servers...

Any help is welcome 😢

<!-- gh-comment-id:723116255 --> @jean-io commented on GitHub (Nov 6, 2020): Well, I did more test... DNS resolution works inside this container. I tried with curl: ``` jean@nuc /opt/ship/bitwarden $ sudo docker exec -it bitwarden bash root@BITWARDEN-CONTAINER:/# curl -i ssl0.ovh.net HTTP/1.1 301 Moved Permanently Content-length: 0 Location: https://www.ovh.co.uk/mail/ Connection: close ```` I have enabled DEBUG and here is the output (note that sending mail with the same credential work in other container): ``` [2020-11-06 13:49:57.384][request][INFO] POST /admin/test/smtp/ [2020-11-06 13:49:57.385][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url"))) [2020-11-06 13:49:57.385][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"]) [2020-11-06 13:49:57.385][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url"))) [2020-11-06 13:49:57.385][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"]) [2020-11-06 13:49:57.385][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url"))) [2020-11-06 13:49:57.385][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"]) [2020-11-06 13:49:57.385][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url"))) [2020-11-06 13:49:57.385][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"]) [2020-11-06 13:49:57.386][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url"))) [2020-11-06 13:49:57.386][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"]) [2020-11-06 13:49:57.386][handlebars::render][DEBUG] Rendering value: Path(Relative(([Named("url")], "url"))) [2020-11-06 13:49:57.386][handlebars::context][DEBUG] Accessing context value: AbsolutePath(["url"]) [2020-11-06 13:50:17.115][error][ERROR] SMTP IO error: Resource temporarily unavailable (os error 11) [2020-11-06 13:50:17.116][response][INFO] POST /admin/test/smtp (test_smtp) => 400 Bad Request ``` My issue is very similar to https://bitwardenrs.discourse.group/t/smtp-unable-to-send-email/145. > This error occurres when the mail server is not reachable or the dns could not be resolved. The error message is not really clear. For some reason there is no DEBUG message related to SMTP, I find it really strange... Any one that got this error has give up so far since SMTP work with gmail but not with custom SMTP servers... Any help is welcome 😢
Author
Owner

@jean-io commented on GitHub (Nov 6, 2020):

I have made progress, I know get this error:

[2020-11-06 15:20:13.166][bitwarden_rs::api::core::accounts][ERROR] Error sending delete account email: SMTP 5xx error: ["5.7.1 Authentication failed"]

I give up on SSL connexion on port 465 and I switched to STARTTLS on port 587. I tested both configuration in other environment: credential are OK. I have no idea why:

  1. I get SMTP IO error: Resource temporarily unavailable (os error 11) for SSL
  2. I get Error sending delete account email: SMTP 5xx error: ["5.7.1 Authentication failed"] for STARTTLS
<!-- gh-comment-id:723147387 --> @jean-io commented on GitHub (Nov 6, 2020): I have made progress, I know get this error: ``` [2020-11-06 15:20:13.166][bitwarden_rs::api::core::accounts][ERROR] Error sending delete account email: SMTP 5xx error: ["5.7.1 Authentication failed"] ``` I give up on SSL connexion on port 465 and I switched to STARTTLS on port 587. I tested both configuration in other environment: credential are OK. I have no idea why: 1. I get `SMTP IO error: Resource temporarily unavailable (os error 11)` for **SSL** 2. I get `Error sending delete account email: SMTP 5xx error: ["5.7.1 Authentication failed"]` for **STARTTLS**
Author
Owner

@thelittlefireman commented on GitHub (Nov 6, 2020):

Same issue.
I try all the possibilities 465/587/25 with ssl, force tls. nothing worked.
Sometimes it's authentication failed, sometimes it's the empty response.

My server and credentials are all double check and ok because i used them on the same server on other services.
Thanks

version docker 1.17.0

<!-- gh-comment-id:723302402 --> @thelittlefireman commented on GitHub (Nov 6, 2020): Same issue. I try all the possibilities 465/587/25 with ssl, force tls. nothing worked. Sometimes it's authentication failed, sometimes it's the empty response. My server and credentials are all double check and ok because i used them on the same server on other services. Thanks version docker 1.17.0
Author
Owner

@BlackDex commented on GitHub (Nov 7, 2020):

Please try to change or add multiple authentication mechanisms.
github.com/dani-garcia/bitwarden_rs@ec920b5756/.env.template (L255)

<!-- gh-comment-id:723427686 --> @BlackDex commented on GitHub (Nov 7, 2020): Please try to change or add multiple authentication mechanisms. https://github.com/dani-garcia/bitwarden_rs/blob/ec920b5756fdae0b64edde328f634fbe2cd92ac0/.env.template#L255
Author
Owner

@misilot commented on GitHub (Nov 7, 2020):

I am seeing this as well on our setup. I don't recall seeing it when we were on 1.16.3.

We have an SMTP relay setup that we use. No user authentication, the system is authenticated via IP and just straight send it emails. The host for docker utilizes the same relayhost and we have not seen any DNS resolution errors in the logs for the mail it sends out.

<!-- gh-comment-id:723447157 --> @misilot commented on GitHub (Nov 7, 2020): I am seeing this as well on our setup. I don't recall seeing it when we were on 1.16.3. We have an SMTP relay setup that we use. No user authentication, the system is authenticated via IP and just straight send it emails. The host for docker utilizes the same relayhost and we have not seen any DNS resolution errors in the logs for the mail it sends out.
Author
Owner

@jean-io commented on GitHub (Nov 7, 2020):

Please try to change or add multiple authentication mechanisms.

My SMTP server sould work only with login method. But I have udated my config with what you requested: "smtp_auth_mechanism": "Login,Plain,Xoauth2",. Still nothing... I get always get Error sending delete account email: SMTP 5xx error: ["5.7.1 Authentication failed"].

<!-- gh-comment-id:723449894 --> @jean-io commented on GitHub (Nov 7, 2020): > Please try to change or add multiple authentication mechanisms. My SMTP server sould work only with login method. But I have udated my config with what you requested: `"smtp_auth_mechanism": "Login,Plain,Xoauth2",`. Still nothing... I get always get `Error sending delete account email: SMTP 5xx error: ["5.7.1 Authentication failed"]`.
Author
Owner

@thelittlefireman commented on GitHub (Nov 7, 2020):

hi, thanks for you reply @BlackDex . I try too "Login" and "Plain" mix. It doesn't work.

<!-- gh-comment-id:723462611 --> @thelittlefireman commented on GitHub (Nov 7, 2020): hi, thanks for you reply @BlackDex . I try too "Login" and "Plain" mix. It doesn't work.
Author
Owner

@jean-io commented on GitHub (Nov 12, 2020):

👋 @dani-garcia @BlackDex any update ? No luck on my side 😔

<!-- gh-comment-id:726317230 --> @jean-io commented on GitHub (Nov 12, 2020): 👋 @dani-garcia @BlackDex any update ? No luck on my side 😔
Author
Owner

@BlackDex commented on GitHub (Nov 12, 2020):

@jean-io, well, it's hard for us to test user specific configurations of course. And we are limited to the errors we get returned from the email library. I don't know if you are using a mail server under your own control, and if so, please check the logs there.

I don't know if you have tried the option to enable implicit ssl?
Be aware, that the variable name is misleading here.
github.com/dani-garcia/bitwarden_rs@e25fc7083d/.env.template (L247)

<!-- gh-comment-id:726322157 --> @BlackDex commented on GitHub (Nov 12, 2020): @jean-io, well, it's hard for us to test user specific configurations of course. And we are limited to the errors we get returned from the email library. I don't know if you are using a mail server under your own control, and if so, please check the logs there. I don't know if you have tried the option to enable implicit ssl? Be aware, that the variable name is misleading here. https://github.com/dani-garcia/bitwarden_rs/blob/e25fc7083de6703af23f576c5d469600c7036254/.env.template#L247
Author
Owner

@misilot commented on GitHub (Nov 12, 2020):

Could it be an underlying DNS/network issue in the container to external resources? As I am having similar issues with this and connecting to a remote mysql database in #1204

<!-- gh-comment-id:726326014 --> @misilot commented on GitHub (Nov 12, 2020): Could it be an underlying DNS/network issue in the container to external resources? As I am having similar issues with this and connecting to a remote mysql database in #1204
Author
Owner

@BlackDex commented on GitHub (Nov 12, 2020):

@misilot only if you get a message regarding resource unavailable. That could indicate DNS issue or wrong port, or firewall issues etc.. there are also some strange issues sometimes with docker(-compose) and if users fully stop, pull, start it sometimes starts working as it should.

The error regarding credentials is mostly wrong configuration like username, password, auth mechanism or even wrong port.
Strange copy paste issues with passwords or usernames with some special characters can happen and cause issues.

<!-- gh-comment-id:726338448 --> @BlackDex commented on GitHub (Nov 12, 2020): @misilot only if you get a message regarding resource unavailable. That could indicate DNS issue or wrong port, or firewall issues etc.. there are also some strange issues sometimes with docker(-compose) and if users fully stop, pull, start it sometimes starts working as it should. The error regarding credentials is mostly wrong configuration like username, password, auth mechanism or even wrong port. Strange copy paste issues with passwords or usernames with some special characters can happen and cause issues.
Author
Owner

@jean-io commented on GitHub (Nov 14, 2020):

I don't know if you have tried the option to enable implicit ssl?

Not yet! I will try when I get back to home in few days. I hope this will work! 🤩

Regarding copy/paste errors, I will check once again, human error does happen but I already triple checked. 🤪

<!-- gh-comment-id:727170837 --> @jean-io commented on GitHub (Nov 14, 2020): > I don't know if you have tried the option to enable implicit ssl? Not yet! I will try when I get back to home in few days. I hope this will work! 🤩 Regarding copy/paste errors, I will check once again, human error does happen but I already triple checked. 🤪
Author
Owner

@BlackDex commented on GitHub (Nov 18, 2020):

As a note:
If you are using port 465 kinda dictates that you need Implicit TLS enabled (Thus enable SMTP_EXPLICIT_TLS=true).
When using ports 25 or 587, that means using STARTTLS, which upgrades an existing unencrypted connection to use TLS during the connection.

I have created a PR #1229 which has some changes to enable smtp debugging to troubleshoot issues.

<!-- gh-comment-id:729623641 --> @BlackDex commented on GitHub (Nov 18, 2020): As a note: If you are using port 465 kinda dictates that you need Implicit TLS enabled (Thus enable SMTP_EXPLICIT_TLS=true). When using ports 25 or 587, that means using STARTTLS, which upgrades an existing unencrypted connection to use TLS during the connection. I have created a PR #1229 which has some changes to enable smtp debugging to troubleshoot issues.
Author
Owner

@BlackDex commented on GitHub (Nov 18, 2020):

The version with the debug option is available on docker hub when using the testing tag.

github.com/dani-garcia/bitwarden_rs@5379329ef7/.env.template (L265)

<!-- gh-comment-id:730010766 --> @BlackDex commented on GitHub (Nov 18, 2020): The version with the debug option is available on docker hub when using the `testing` tag. https://github.com/dani-garcia/bitwarden_rs/blob/5379329ef71ba4b600eb028d721806a16e62535f/.env.template#L265
Author
Owner

@jean-io commented on GitHub (Nov 23, 2020):

Hello,

I just came back from vacation, so it's time to do some SMTP debug.

Good news: with new SMTP debug information from testing image tag, I had more information to resolve this issue, I have found that:

  • with parameter SMTP_EXPLICIT_TLS=true my container is able to open a connection my OVH SMTP server.
  • I have found a mismatch of password between my Bitwarden safe and my Bitwarden config 💩 ... @BlackDex you were right: I owe you a beer 🍺

Now I have to find why mails are coming as spam for Bitwarden and not for Nextcloud...

Thank you all for your help !

<!-- gh-comment-id:732226238 --> @jean-io commented on GitHub (Nov 23, 2020): Hello, I just came back from vacation, so it's time to do some SMTP debug. Good news: with new SMTP debug information from `testing` image tag, I had more information to resolve this issue, I have found that: - with parameter `SMTP_EXPLICIT_TLS=true` my container is able to open a connection my OVH SMTP server. - I have found a mismatch of password between my Bitwarden safe and my Bitwarden config 💩 ... @BlackDex you were right: I owe you a beer 🍺 Now I have to find why mails are coming as spam for Bitwarden and not for Nextcloud... Thank you all for your help !
Author
Owner

@keshamin commented on GitHub (Aug 31, 2021):

I faced the same error while trying to set up Yandex (russian tech company) SMTP server. The solution was to tick both SSL and TLS checkboxes.
image

"Resource temporary unavailable" error message a bit misleads.

<!-- gh-comment-id:909733466 --> @keshamin commented on GitHub (Aug 31, 2021): I faced the same error while trying to set up Yandex (russian tech company) SMTP server. The solution was to tick both SSL and TLS checkboxes. ![image](https://user-images.githubusercontent.com/25623173/131589503-3a6ddd42-5c10-43dd-afdf-06abd5b308e7.png) "Resource temporary unavailable" error message a bit misleads.
Author
Owner

@BlackDex commented on GitHub (Sep 1, 2021):

I faced the same error while trying to set up Yandex (russian tech company) SMTP server. The solution was to tick both SSL and TLS checkboxes.
image

"Resource temporary unavailable" error message a bit misleads.

That isn't needed anymore for a while now.
You can tick just force tls for this to work. Previously you needed to tick both indeed.

<!-- gh-comment-id:909930046 --> @BlackDex commented on GitHub (Sep 1, 2021): > I faced the same error while trying to set up Yandex (russian tech company) SMTP server. The solution was to tick both SSL and TLS checkboxes. > ![image](https://user-images.githubusercontent.com/25623173/131589503-3a6ddd42-5c10-43dd-afdf-06abd5b308e7.png) > > "Resource temporary unavailable" error message a bit misleads. That isn't needed anymore for a while now. You can tick just force tls for this to work. Previously you needed to tick both indeed.
Author
Owner

@chunjinfeng commented on GitHub (Dec 18, 2021):

Same issue. I try all the possibilities 465/587/25 with ssl, force tls. nothing worked. Sometimes it's authentication failed, sometimes it's the empty response.

My server and credentials are all double check and ok because i used them on the same server on other services. Thanks

version docker 1.17.0

I force tls and solved the
SMTP IO error: Resource temporarily unavailable (os error 11)
error

<!-- gh-comment-id:997110338 --> @chunjinfeng commented on GitHub (Dec 18, 2021): > Same issue. I try all the possibilities 465/587/25 with ssl, force tls. nothing worked. Sometimes it's authentication failed, sometimes it's the empty response. > > My server and credentials are all double check and ok because i used them on the same server on other services. Thanks > > version docker 1.17.0 I force tls and solved the SMTP IO error: Resource temporarily unavailable (os error 11) error
Author
Owner

@sanger89 commented on GitHub (Nov 22, 2022):

I used docker-compose deployed vaultwarden.
When I use 163.com or personal email sever, it didn't work.
I fix it in this way: replace the smtp server to outlook, and it works.

<!-- gh-comment-id:1323276096 --> @sanger89 commented on GitHub (Nov 22, 2022): I used docker-compose deployed vaultwarden. When I use 163.com or personal email sever, it didn't work. I fix it in this way: replace the smtp server to outlook, and it works.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#848
No description provided.