You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configure a custom SMTP server as part of the appwrite selfhost docker installation (APP_SMTP*) in the .env file.
👍 Expected behavior
Emails should be send for password recovery or email verification when requested from the console.
👎 Actual Behavior
No emails are generated, instead the (appwrite-worker-mails) log shows
[Job] (68fb524fabcf82.31712895) Error sending mail: SMTP Error: Could not authenticate.
[Error] Type: Exception
[Error] Message: Error sending mail: SMTP Error: Could not authenticate.
[Error] File: /usr/src/code/src/Appwrite/Platform/Workers/Mails.php
[Error] Line: 173
The same smtp configuration works fine when configured as a custom SMTP server in the project settings and account verification links are generated through the API.
🎲 Appwrite version
Version 1.8.x
💻 Operating system
Linux
🧱 Your Environment
I'm self hosting a fresh install of appwrite 1.8.0 using docker.
👀 Have you spent some time to check if this issue has been raised before?
Yes. I configured it as a custom SMTP server for my project and also configured the same server in the .env file for the appwrite instance. It works for the project (when I need it to send out verification emails or mfa codes) but it doesn't work when appwrite itself should send out emails (e.g. when I needed to recover the appwrite admin's password).
@Luo-En What if you leave it only for the SMTP? It's still not working?
What are the env varibales that you have set?
Also, after setting them, did you recreate the containers with docker compose up -d or `docker compose up -d --force-recreate´?
I started with only the SMTP settings in the .env and that didn't work. I was quite surprised to see that it worked in the project settings though.
I never used compose up-d --force-recreate, just docker compose up -d. Want me to try that?
[Settings]
🟢 Hostname is valid ([redacted])
🟢 CNAME record target is valid ([redacted])
🟢 A record target is valid (127.0.0.1)
🟢 AAAA record target is valid (::1)
🟢 Using a unique secret key for encryption
🟢 App environment is set for production
🔴 Abuse protection is disabled
🟢 Console access limits are enabled
🔴 HTTPS force option is disabled
🔴 HTTPS force option is disabled for function/site domains
🔴 Logging adapter is misconfigured
[Connectivity]
🟢 Console.DB(console)...............................connected
🟢 Projects.DB(database_db_main).....................connected
🟢 Cache(cache_redis_main)...........................connected
Warning: foreach() argument must be of type array|object, null given in /usr/src/code/src/Appwrite/Platform/Tasks/Doctor.php on line 177
🟢 PubSub(pubsub)....................................connected
🔴 SMTP...........................................disconnected
[Volumes]
🟢 Uploads Volume is readable
🟢 Uploads Volume is writeable
🟢 Cache Volume is readable
🟢 Cache Volume is writeable
🟢 Config Volume is readable
🟢 Config Volume is writeable
🟢 Certs Volume is readable
🟢 Certs Volume is writeable
[Disk Space]
🟢 Uploads Volume has 991.82GB free space (49.6% used)
🟢 Cache Volume has 991.82GB free space (49.6% used)
🟢 Config Volume has 991.82GB free space (49.6% used)
🟢 Certs Volume has 991.82GB free space (49.6% used)
Same problem after docker compose up -d --force-recreate and trying to verify admin's email (also made sure I copied the password from the project settings into the .env file):
[Job] (68ff5ae18be1b9.45121464) failed to run.
[Job] (68ff5ae18be1b9.45121464) Error sending mail: SMTP Error: Could not authenticate.
[Error] Type: Exception
[Error] Message: Error sending mail: SMTP Error: Could not authenticate.
[Error] File: /usr/src/code/src/Appwrite/Platform/Workers/Mails.php
[Error] Line: 173
[Job] Received Job (68ff7722d74976.64688351).
---- took several minutes ----
[Job] (68ff7722d74976.64688351) failed to run.
[Job] (68ff7722d74976.64688351) Error sending mail: SMTP Error: Could not connect to SMTP host.
[Error] Type: Exception
[Error] Message: Error sending mail: SMTP Error: Could not connect to SMTP host.
[Error] File: /usr/src/code/src/Appwrite/Platform/Workers/Mails.php
[Error] Line: 173
We're getting closer: tried with gmail and that works. Then generated a fresh API key from resend.com (which is used as the SMTP password), their SMTP server and required username and got the same exception as above ('data not accepted'). So it seems to be something specific when using resend as SMTP server.
@Luo-En Oh Great for you! This means the resend SMTP server is rejecting the email. In SMTP, sending an email goes through several steps: HELO, MAIL FROM, RCPT TO, DATA, and QUIT. The issue is at the DATA stage, where the SMTP server is rejecting your delivery. This is not an issue with your Appwrite instance.
Previously, I was using SendPulse, but today I switched to my own custom SMTP server (also configured on the same VPS as my Appwrite:1.8.0 instance.), and it is working perfectly.
@usmandilmeer What remains is the question why the same configuration then works in my appwrite project settings. Emails generated there work fine (using resend.com). It's not a blocking issue for me now but it might make sense to investigate why the same settings work as an appwrite project SMTP server but not for the appwrite instance (console) itself.
@Luo-En I think the problem occurs when Appwrite sends emails using Resend—there may be additional headers required by Resend that are causing the delivery to be rejected.
Currently, if Gmail SMTP is working and your issue with sending emails via the Appwrite instance is resolved, you can use it for Appwrite, while continuing to use Resend for regular emails.
Fixed my SMTP authentication error. Email setting in the Appwrite console were different from the SMTP values in the .env file of self-hosted instance.
@usmandilmeer I just tested it, resend config works for console emails. Tested with TLS and port 587. Sent an invitation link to a project to one of my gmail accounts. Worked as expected. It wasn't working earlier, but I created a new resend API keys and it just started working. Strange.
Activity
DH-555 commentedon Oct 27, 2025
@Luo-En Are you using it for both in the .env variables and also inside the console?
Luo-En commentedon Oct 27, 2025
Yes. I configured it as a custom SMTP server for my project and also configured the same server in the .env file for the appwrite instance. It works for the project (when I need it to send out verification emails or mfa codes) but it doesn't work when appwrite itself should send out emails (e.g. when I needed to recover the appwrite admin's password).
DH-555 commentedon Oct 27, 2025
@Luo-En What if you leave it only for the SMTP? It's still not working?
What are the env varibales that you have set?
Also, after setting them, did you recreate the containers with
docker compose up -dor `docker compose up -d --force-recreate´?What's the result of
docker exec appwrite doctor?Luo-En commentedon Oct 27, 2025
I started with only the SMTP settings in the .env and that didn't work. I was quite surprised to see that it worked in the project settings though.
I never used
compose up-d --force-recreate, justdocker compose up -d. Want me to try that?DH-555 commentedon Oct 27, 2025
Yes, try that. What variables have you set?
Luo-En commentedon Oct 27, 2025
Luo-En commentedon Oct 27, 2025
Same problem after
docker compose up -d --force-recreateand trying to verify admin's email (also made sure I copied the password from the project settings into the .env file):DH-555 commentedon Oct 27, 2025
Try setting those envs:
_APP_SYSTEM_EMAIL_NAME
_APP_SYSTEM_EMAIL_ADDRESS
Luo-En commentedon Oct 27, 2025
They were already set. I changed them to match my admin user but still same exception from appwrite-worker-emails.
DH-555 commentedon Oct 27, 2025
Try this:
_APP_SMTP_PORT=465
_APP_SMTP_SECURE=tls
DH-555 commentedon Oct 27, 2025
After making the change make sure to run docker compose up -d
Luo-En commentedon Oct 27, 2025
Slightly different exception:
usmandilmeer commentedon Oct 28, 2025
SMTP port 587 requires TLS, while port 465 requires SSL.
You can configure this in your Appwrite .env file as follows:
Port 587: _APP_SMTP_SECURE="tls"
Port 465: _APP_SMTP_SECURE="ssl"
After updating the .env file, run:
I’m using this configuration on my Appwrite 1.8.0 instance on a VPS, and it’s working perfectly.
DH-555 commentedon Oct 28, 2025
@usmandilmeer what of those: the tls one or SSL are you using?
Luo-En commentedon Oct 28, 2025
Both 587/"tls" and 465/"ssl" give me the same exception:
usmandilmeer commentedon Oct 28, 2025
I am using "tls" with port 587 and it is perfectly for my self hosted appwrite.
usmandilmeer commentedon Oct 28, 2025
Are you using a self-hosted SMTP server or a third-party provider?
For debugging, you can try using Gmail SMTP with an app password generated from your Gmail account as the SMTP password.
The error you’re seeing indicates an issue at the DATA stage of SMTP. This is the step where the email body and headers are sent.
data not accepted means the SMTP server rejected the email content or refused to accept the email for delivery.
Luo-En commentedon Oct 28, 2025
We're getting closer: tried with gmail and that works. Then generated a fresh API key from resend.com (which is used as the SMTP password), their SMTP server and required username and got the same exception as above ('data not accepted'). So it seems to be something specific when using resend as SMTP server.
usmandilmeer commentedon Oct 28, 2025
@Luo-En Oh Great for you! This means the resend SMTP server is rejecting the email. In SMTP, sending an email goes through several steps: HELO, MAIL FROM, RCPT TO, DATA, and QUIT. The issue is at the DATA stage, where the SMTP server is rejecting your delivery. This is not an issue with your Appwrite instance.
Previously, I was using SendPulse, but today I switched to my own custom SMTP server (also configured on the same VPS as my Appwrite:1.8.0 instance.), and it is working perfectly.
Luo-En commentedon Oct 28, 2025
@usmandilmeer What remains is the question why the same configuration then works in my appwrite project settings. Emails generated there work fine (using resend.com). It's not a blocking issue for me now but it might make sense to investigate why the same settings work as an appwrite project SMTP server but not for the appwrite instance (console) itself.
usmandilmeer commentedon Oct 28, 2025
@Luo-En I think the problem occurs when Appwrite sends emails using Resend—there may be additional headers required by Resend that are causing the delivery to be rejected.
Currently, if Gmail SMTP is working and your issue with sending emails via the Appwrite instance is resolved, you can use it for Appwrite, while continuing to use Resend for regular emails.
sunny0402 commentedon Nov 5, 2025
I also get the SMTP could not authenticate error. I am using Appwrite verssion 1.6.0.
But I am able to send an email from inside the appwrite-worker-mails container using swaks. Thus confirming SMTP credentials.
I can also confirm my variables are set.
But when I make a request from my frontend to reset a password I get the authentication error. The request goes through with status code 201.
sunny0402 commentedon Dec 14, 2025
Fixed my SMTP authentication error. Email setting in the Appwrite console were different from the SMTP values in the .env file of self-hosted instance.
https://www.sunnyappdev.com/blog/mailgun-smtp-self-hosted-appwrite
Pipe-Runner commentedon Feb 11, 2026
@usmandilmeer I just tested it, resend config works for console emails. Tested with TLS and port 587. Sent an invitation link to a project to one of my gmail accounts. Worked as expected. It wasn't working earlier, but I created a new resend API keys and it just started working. Strange.