
My appwrite self-hosted instance on DigitalOcean cannot sennd emails. The following results were performed
Log:
docker compose logs -f appwrite-worker-mails
appwrite-worker-mails | [Worker] Worker 0 is ready!
appwrite-worker-mails | Worker mails started
appwrite-worker-mails | [Job] Received Job (680cb38fa668a7.96149614).
appwrite-worker-mails | [Job] (680cb38fa668a7.96149614) failed to run.
appwrite-worker-mails | [Job] (680cb38fa668a7.96149614) Error sending mail: SMTP Error: Could not connect to SMTP host. Failed to connect to server
appwrite-worker-mails | Error log pushed with status code: 200
appwrite-worker-mails | [Error] Type: Exception
appwrite-worker-mails | [Error] Message: Error sending mail: SMTP Error: Could not connect to SMTP host. Failed to connect to server
appwrite-worker-mails | [Error] File: /usr/src/code/src/Appwrite/Platform/Workers/Mails.php
appwrite-worker-mails | [Error] Line: 145
Environment Variables:
docker compose exec appwrite-worker-mails vars | grep SMTP
- _APP_SMTP_HOST=smtp.sendgrid.net
- _APP_SMTP_PORT=465
- _APP_SMTP_SECURE=tls
- _APP_SMTP_USERNAME=apikey
- _APP_SMTP_PASSWORD=SG.***

OpenSSL test using command with -tls1
, -tls1_2
#!/bin/sh
TO=email@mydomain.com
if [ ! -z "$1" ]; then
TO=$1
fi
COMMAND='echo -e "From: <$_APP_SYSTEM_EMAIL_ADDRESS>\nSubject: Test SMTP Connection" | sendmail -H "openssl s_client -quiet -tls1 -connect $_APP_SMTP_HOST:$_APP_SMTP_PORT" -au$_APP_SMTP_USERNAME -ap$_APP_SMTP_PASSWORD -f $_APP_SYSTEM_EMAIL_ADDRESS -v'
COMMAND="${COMMAND} ${TO}"
docker compose exec appwrite-worker-mails sh -c "$COMMAND"
Output:
sendmail: send:'NOOP'
283B591CE6700000:error:8000006E:system library:BIO_connect:Operation timed out:crypto/bio/bio_sock2.c:178:calling connect()
283B591CE6700000:error:10000067:BIO routines:BIO_connect:connect error:crypto/bio/bio_sock2.c:180:
283B591CE6700000:error:8000006E:system library:BIO_connect:Operation timed out:crypto/bio/bio_sock2.c:178:calling connect()
283B591CE6700000:error:10000067:BIO routines:BIO_connect:connect error:crypto/bio/bio_sock2.c:180:
connect:errno=110
sendmail: helper exited (1)

I can send an email Using the Messaging > Providers > Sendgrid

Adding it in Settings > SMPT will result an error
Recommended threads
- Cannot create a user
Hi, I am using a lowcoder frontend and trying to create a user in Appwrite (python function). Unfortunately, all I got is an error: "Raw body: Error". It means...
- Invalid credentials after migration
Hi everyone! After migrating our self-hosted Appwrite 1.3.1 to another server (staging, so a different domain), we are now getting 'Invalid credentials' when ...
- I am getting a 401 unauthorized response...
I have a Next.js application that stores user PDFs. I'm able to save them normally, but when trying to access the files using getFileView, I get a 401 Unauthori...
