Skip to content
Back

Could not connect to SMTP server: SMTP Error: Could not connect to SMTP host.

  • 0
  • Self Hosted
  • General
THE-E
26 Oct, 2025, 15:42

Hi there,

I have currently an issue configuring my SMTP (Custom SMTP server) setting in appwrite. My Setup:

  • Self-hosted (DigitalOcean): appwrite 1.8.0
  • SMTP-Host: Google Workspace (with 2-Faktor authentication)
  • Nginx reverse proxy for the SSL certificates

I have configured all environment variables in the .env file (and obviously restarted). I get the following values for docker compose exec appwrite-worker-mails vars

TypeScript
- _APP_SMTP_HOST=smtp.gmail.com
- _APP_SMTP_PORT=587
- _APP_SMTP_SECURE=tls
- _APP_SMTP_USERNAME=info@example.com
- _APP_SMTP_PASSWORD=****(using an app password)

In appwrite I am unable to set: Custom SMTP server. I keep getting the error:

TypeScript
Could not connect to SMTP server: SMTP Error: Could not connect to SMTP host. Failed to connect to server

It also does not override the settings, when I click on Update. If I reload the page, Custom SMTP server is always deactivated. At the beginning I had values set, which I was able to override by deactivating the Custom SMTP server switch. Now I can't override it. I guess only after validation values are stored in the database?

In the appwrite logs I get:

TypeScript
[Error] Timestamp: 2025-10-26T15:32:06+00:00
[Error] Method: PATCH
[Error] URL: /v1/projects/:projectId/smtp
[Error] Type: Appwrite\Extend\Exception
[Error] Message: Could not connect to SMTP server: SMTP Error: Could not connect to SMTP host. Failed to connect to server
[Error] File: /usr/src/code/app/controllers/api/projects.php
[Error] Line: 2091

I tested the credentials using gotmp and could successfully send mails on the first try (using username and the generated app password).

Two changes to mention: I updated from appwrite 1.7.4 to 1.8.0. Furthermore, I changed the domain of my Google Workspace (but obviously adjusted my variables to login).

I am little clueless, what to check next. It would be really nice, if someone could give me a hint, what I am missing.

TL;DR
Developers are facing issues connecting to the SMTP server in Appwrite. They have configured SMTP settings with Google Workspace using the correct environment variables but are unable to save the Custom SMTP server settings in Appwrite. The error "Could not connect to SMTP server: SMTP Error: Could not connect to SMTP host" persists. The logs show errors related to the SMTP connection problem after upgrading to Appwrite 1.8.0 and changing the Google Workspace domain. The developer successfully tested the credentials with `gotmp`. Suggestions for next steps to troubleshoot include verifying SMTP settings, checking for any recent configuration changes, and investigating the validation process for storing
THE-E
26 Oct, 2025, 15:54

I tried a mail-verification and the logs of the mail-worker is:

TypeScript
[Job] Received Job (68fe43044768e8.96771826).
[Job] (68fe43044768e8.96771826) failed to run.
[Job] (68fe43044768e8.96771826) Error sending mail: SMTP Error: Could not connect to SMTP host. Failed to connect to server
[Error] Type: Exception
[Error] Message: Error sending mail: SMTP Error: Could not connect to SMTP host. Failed to connect to server
[Error] File: /usr/src/code/src/Appwrite/Platform/Workers/Mails.php
[Error] Line: 173
THE-E
26 Oct, 2025, 15:56

In the appwirte logs I do get also the error:

TypeScript
[Error] Timestamp: 2025-10-26T15:50:26+00:00
[Error] Method: GET
[Error] URL: /v1/migrations
[Error] Type: Utopia\Database\Exception\Query
[Error] Message: Invalid query: Attribute not found in schema: destination
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Database.php
[Error] Line: 6723
[Error] Timestamp: 2025-10-26T15:52:07+00:00
[Error] Method: GET
[Error] URL: /v1/migrations
[Error] Type: Utopia\Database\Exception\Query
[Error] Message: Invalid query: Attribute not found in schema: destination
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Database.php
[Error] Line: 6723
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more