.env file setup but test e-mail returning "Unable to connect to localhost:587" #4601

Closed
opened 2026-02-05 09:07:03 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @ZuluPilgrim on GitHub (Apr 9, 2024).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I am using docker compose to spin up a bookstack instance.

I have the below .env file

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_USERNAME=email@gmail.com
MAIL_PASSWORD=pwd
MAIL_FROM=email@gmail.com
MAIL_FROM_NAME=Recipes

I restarted the container but when I try a test, I get

Error thrown when sending a test email: Connection could not be established with host "localhost:587": tream_socket_client(): Unable to connect to localhost:587 (Address not available)

I would have thought should be seeing a reference to gmail.com in the error which leads me to think that the .env file is not being referenced.

Exact BookStack Version

BookStack v24.02.3

Log Content

docker logs container-id did not return anything.

Hosting Environment

Ubuntu 22.04.4
Docker 25.0.4
Docker Compose version v2.3.3

Originally created by @ZuluPilgrim on GitHub (Apr 9, 2024). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario I am using docker compose to spin up a bookstack instance. I have the below .env file ``` MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_ENCRYPTION=tls MAIL_USERNAME=email@gmail.com MAIL_PASSWORD=pwd MAIL_FROM=email@gmail.com MAIL_FROM_NAME=Recipes ``` I restarted the container but when I try a test, I get `Error thrown when sending a test email: Connection could not be established with host "localhost:587": tream_socket_client(): Unable to connect to localhost:587 (Address not available)` I would have thought should be seeing a reference to gmail.com in the error which leads me to think that the .env file is not being referenced. ### Exact BookStack Version BookStack v24.02.3 ### Log Content docker logs container-id did not return anything. ### Hosting Environment Ubuntu 22.04.4 Docker 25.0.4 Docker Compose version v2.3.3
OVERLORD added the 🐕 Support label 2026-02-05 09:07:03 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4601