BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
14.67k stars 1.85k forks source link

Unable to send email #4752

Closed beddows closed 7 months ago

beddows commented 7 months ago

Attempted Debugging

Searched GitHub Issues

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

ssddanbrown commented 7 months ago

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...).

beddows commented 7 months ago

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 7 months ago

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

ssddanbrown commented 7 months ago

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).

beddows commented 7 months ago

@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.