Email configuration not working

Hello,
I added the following configuration for email in docker-compose.yml file:

and when I ran docker compose up -d, the speckle-server took a lot of time and still not running:

my server is in https:// and I registered on mailtrap the demo smtp for testing.

Thank you in advance!

Hi @karimsafar

I am far from the server expert around here and those who are taking a break. However, I’m dangerous enough to speculate the issue may be related to the email configuration, specifically the connection to the SMTP service. From your screenshot, the speckle-server container is stuck in a “Waiting” state, which often indicates the server cannot complete its startup sequence due to a dependency or configuration issue.

While I’m not actively familiar with Mailtrap, here are a few things you can check and try based on common SMTP setups - in this case, the server might be trying to initialise the email service (since it’s enabled in your configuration) but failing to connect to Mailtrap’s SMTP server. Common reasons for this could include:

  1. Misconfigured Email Settings:
  • For example, the server could be waiting indefinitely for a response from the SMTP service if the EMAIL_HOST, EMAIL_PORT, EMAIL_USERNAME, or EMAIL_PASSWORD are incorrect.
  1. Network or TLS Issues:
  • The server might be attempting to establish a secure connection (TLS/STARTTLS) but failing due to a missing EMAIL_SECURE setting. Since Mailtrap requires STARTTLS on port 587, you may need to set EMAIL_SECURE: "false" to enable it.
  1. Timeouts or Failed Authentication:
  • If the server can’t authenticate with the SMTP server, it might be retrying the connection multiple times, which can cause long startup delays.

To troubleshoot this further, you can:

  1. Inspect the Logs:
  • Check the logs of the speckle-server container for errors related to email:
docker logs speckle-server-speckle-server-1

Look for errors such as “Cannot connect to SMTP server,” “Authentication failed,” or “Connection timed out.”

  1. Test SMTP Connectivity:
  • Open a shell in the speckle-server container:
docker exec -it speckle-server-speckle-server-1 sh
  • Test the connection to Mailtrap:
telnet live.smtp.mailtrap.io 587

If this fails, the container might have trouble reaching Mailtrap.

  1. Disable Email Temporarily:
  • Set EMAIL: "false" in your configuration and restart the server. If the server starts without delays, it confirms the issue is related to email.

If you find something unusual in the logs or have more details, please share them here. I am happy to help troubleshoot further!