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
{{ message }}
This repository was archived by the owner on Sep 29, 2023. It is now read-only.
<p>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.</p>
2
-
3
-
<p>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.</p>
4
-
5
-
<p>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.</p>
6
-
7
-
<h2>Update your docker-compose.yml File</h2>
8
-
9
-
<p>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.</p>
<p>Appwrite v0.7 and above come with support for easy integrations with 3rd party SMTP providers. In order for emails to work, you will need to setup proper SMTP configuration as described below.</p>
2
+
3
+
<p>Because email deliverability can be both tricky and hard, it is often easier to delegate this responsibility to a 3rd-party SMTP provider. These providers help you abstract the complexity of passing SPAM filters by doing a lot of the advanced configuration and validation for you.</p>
4
+
5
+
<p>In this document, you will learn how to connect a 3rd party SMTP provider like MailGun or SendGrid with Appwrite to help you get better email deliverability.</p>
56
6
57
-
<p><b>_APP_SMTP_HOST</b> - SMTP server host name address. Default value is: ‘smtp’</p>
7
+
<h2>Update Your .env File</h2>
58
8
59
-
<p><b>_APP_SMTP_PORT</b> - SMTP server TCP port. Default value is: ‘25’</p>
9
+
<p>At this stage, we assume that you have already installed Appwrite. Else, you can follow our <a href="/docs/installation">Getting Started Guide</a> for the installation. Appwrite offers multiple environment variables to customize your server setup to your needs. To configure Appwrite to use your own SMTP server, you need to set the following environment variables in the hidden .env file that comes with your Appwrite installation.</p>
10
+
11
+
<p><b>_APP_SMTP_HOST</b> - SMTP server host name address. Use an empty string to disable all mail sending from the server. The default value for this variable is an empty string</p>
12
+
13
+
<p><b>_APP_SMTP_PORT</b> - SMTP server TCP port. Empty by default.</p>
60
14
61
15
<p><b>_APP_SMTP_SECURE</b> - SMTP secure connection protocol. Empty by default, change to ‘tls’ if running on a secure connection.</p>
62
16
63
17
<p><b>_APP_SMTP_USERNAME</b> - SMTP server user name. Empty by default.</p>
64
18
65
19
<p><b>_APP_SMTP_PASSWORD</b> - SMTP server user password. Empty by default.</p>
66
20
67
-
<h2>Remove the Default SMTP Container</h2>
68
-
69
-
<p>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:</p>
<p>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:</p>
37
+
<p>Once you've updated your .env file, you need to restart your Appwrite stack using the following command from your terminal:</p>
<pre class="line-numbers"><code class="prism language-bash" data-prism>docker-compose up -d</code></pre>
102
41
</div>
103
42
104
-
<p>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.</p>
43
+
<h2>Debugging</h2>
44
+
45
+
<p>If you are unable to send emails, there is most likely an issue with your integration. The first place to look for possible errors is the <b>Appwrite Emails Worker</b>. You can access the logs of this container using:
The next possible source of error is the configuration in your .env file. Make sure that the keys and values are correct and test the credentials by sending a test email using your SMTP providers' SDK or cURL requests.
54
+
</p>
55
+
56
+
<p> Moving on to the next source of error. Some SMTP providers have a concept of <a href="https://help.mailgun.com/hc/en-us/articles/217531258-Authorized-Recipients">authorized recipients</a> in their sandbox (or dev) environments and you can only send emails to recipients in this list. Make sure that the recipient of the email that you're trying to send is a part of this list.</p>
57
+
58
+
<p>
59
+
Another source of error could be that the environment variables have not been set in the appwrite container. You can check this using
<pre class="line-numbers"><code class="prism language-bash" data-prism>docker-compose up -d --build --force-recreate</code></pre>
66
+
</div>
67
+
68
+
</p>
69
+
70
+
71
+
<p>Now you can head over to your Appwrite console, logout from your account and try to recover your password or send invites to other team members from your Appwrite console using your newly configured SMTP provider.</p>
0 commit comments