Unable to send email #4385

Closed
opened 2026-02-05 08:44:51 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @beddows on GitHub (Jan 3, 2024).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I'm using the SMTP .env variables with my Mailgun host and credentials, but based on the laravel.log message, it looks like the mail host (smtp.mailgun.org) isn't being used. I'm using Traefik, not sure if that has something to do with it.

Exact BookStack Version

v23.12

Log Content

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

Hosting Environment

PHP 8.1.2, Ubuntu 22.04, Traefik 2.10.7, Docker 24.0.5

Originally created by @beddows on GitHub (Jan 3, 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'm using the [SMTP .env variables](https://www.bookstackapp.com/docs/admin/email-webhooks/) with my Mailgun host and credentials, but based on the laravel.log message, it looks like the mail host (smtp.mailgun.org) isn't being used. I'm using Traefik, not sure if that has something to do with it. ### Exact BookStack Version v23.12 ### Log Content Error thrown when sending a test email: Connection could not be established with host "localhost:587": stream_socket_client): Unable to connect to localhost:587 (Address not available) ### Hosting Environment PHP 8.1.2, Ubuntu 22.04, Traefik 2.10.7, Docker 24.0.5
OVERLORD added the 🐕 Support label 2026-02-05 08:44:51 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jan 3, 2024):

Hi @beddows,
What exactly is your process for setting these .env options for your environment? (What file are you editing, what are you doing after changing etc...).

@ssddanbrown commented on GitHub (Jan 3, 2024): Hi @beddows, What exactly is your process for setting these `.env` options for your environment? (What file are you editing, what are you doing after changing etc...).
Author
Owner

@beddows commented on GitHub (Jan 3, 2024):

Hey @ssddanbrown, I'm editing the .env file on my VPS. I've been using a slightly modified version of this docker-compose.yml to use Traefik, which has worked well (so far). No errors when running 'docker compose logs -f'.

@beddows commented on GitHub (Jan 3, 2024): Hey @ssddanbrown, I'm editing the .env file on my VPS. I've been using a slightly modified version of this [docker-compose.yml](https://github.com/symnixhq/traefik-bookstack/blob/main/traefik-letsencrypt-bookstack-docker-compose.yml) to use Traefik, which has worked well (so far). No errors when running 'docker compose logs -f'.
Author
Owner

@beddows commented on GitHub (Jan 3, 2024):

And just to clarify a bit more, I added the SMTP .env variables after these from traefik-bookstack.

@beddows commented on GitHub (Jan 3, 2024): And just to clarify a bit more, I added the SMTP .env variables after [these from traefik-bookstack](https://github.com/symnixhq/traefik-bookstack/blob/main/.env).
Author
Owner

@ssddanbrown commented on GitHub (Jan 3, 2024):

Okay, assuming you're editing the .env file that's in the same place as your docker-compose file, then that's not used by BookStack at all based upon that setup. That's passed to the traefik container.

You could instead define the SMTP options in the environment part of your bookstack_web: service in your docker-compose file though. You'll need to re-up your compose stack, since I don't think the variables would be taken into account on just a container restart (the container needs to be re-created I think).

@ssddanbrown commented on GitHub (Jan 3, 2024): Okay, assuming you're editing the `.env` file that's in the same place as your docker-compose file, then that's not used by BookStack at all based upon that setup. That's passed to the `traefik` container. You could instead define the SMTP options in the `environment` part of your `bookstack_web:` service in your docker-compose file though. You'll need to re-up your compose stack, since I don't think the variables would be taken into account on just a container restart (the container needs to be re-created I think).
Author
Owner

@beddows commented on GitHub (Jan 3, 2024):

@ssddanbrown It worked! After adding the variables, a restart was all that was required. In hindsight, I don't know why I thought the .env variables would magically appear in the container... Wishful thinking, I guess. Thanks!

For those finding this thread needing a docker-compose.yml for traefik - I'll submit my updates to the traefik-bookstack repo.

@beddows commented on GitHub (Jan 3, 2024): @ssddanbrown It worked! After adding the variables, a restart was all that was required. In hindsight, I don't know why I thought the .env variables would magically appear in the container... Wishful thinking, I guess. Thanks! For those finding this thread needing a docker-compose.yml for traefik - I'll submit my updates to the [traefik-bookstack](https://github.com/symnixhq/traefik-bookstack) repo.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4385