Appwrite above 0.7 version, by default comes with SMTP disabled and warning regarding email messages. In order for emails to work, you will need to setup proper SMTP configuration as described below.
Because email deliverability can be both tricky and hard, it is often easier to delegate this responsibility to a 3rd-party SMTP provider. This provider help you abstract the complexity of passing SPAM filters by doing a lot of the advanced configuration and validation for you.
In this document, you will learn how to connect your own SMTP server or a 3rd party SMTP provider like MailGun or SendGrid with Appwrite to help you get better email deliverability.
Update your docker-compose.yml File
Appwrite offers multiple environment variables to customize your server setup to your needs. To make Appwrite use your own SMTP server instead of the default build-in SMTP server, you need to change the Appwrite container environment variables.
_APP_SMTP_HOST - SMTP server host name address. Default value is: ‘smtp’
_APP_SMTP_PORT - SMTP server TCP port. Default value is: ‘25’
_APP_SMTP_SECURE - SMTP secure connection protocol. Empty by default, change to ‘tls’ if running on a secure connection.
_APP_SMTP_USERNAME - SMTP server user name. Empty by default.
_APP_SMTP_PASSWORD - SMTP server user password. Empty by default.
Remove the Default SMTP Container
If you are using Appwrite 0.7 or below, the Appwrite default setup includes the Appwrite default SMTP container. Now that you are using your own SMTP server setting, you don’t need it anymore. Just remove the SMTP container and relevant dependencies from your docker-compose.yml file:
Restart Your Appwrite Server
After you finished updating and saving your Appwrite docker-compose.yml server you need to restart your Appwrite stack using the following command from your terminal:
That’s it! Go to your Appwrite console again and try to create a new user. If everything went OK, you should get a welcome email in your new user email inbox. As of version 0.5, Appwrite uses its SMTP server to send welcome emails, password recoveries, and user invites. By using a well-configured SMTP server, you can make sure your users enjoy a maximum rate of email deliverability.