Could not connect to SMTP server: SMTP Error: Could not connect to SMTP host.
- 0
- Self Hosted
- General
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
- _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:
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:
[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.
I tried a mail-verification and the logs of the mail-worker is:
[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
In the appwirte logs I do get also the error:
[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
Recommended threads
- Unknown column 'sourceSize' in 'field li...
After migrating from 1.6.1 to 1.7.4 I noticed this message in the logs: `appwrite-worker-stats-resources | 2025-10-26T10:32:38.289577112Z Failed: SQLSTATE[...
- Invalid document structure: Missing requ...
After migrating from 1.6.1 to 1.7.4 I noticed this message in the logs: appwrite-worker-audits | 2025-10-26T11:15:24.062537020Z Error processing a...
- New attribute stuck on processing?
I was running out of disk space and after creating an attribute and restarting my appwrite (self hosted) I have an attribute stuck on creation. Any way to remov...