docs/main/administration-guide/configure/smtp-email.mdx
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
<PlanAvailability slug="all-commercial" />In a production environment, Mattermost requires SMTP email enabled for email notifications and password resets when using email-based authentication.
Any SMTP email service can be used. You need a copy of the following information: Server Name, Port, SMTP Username, and SMTP Password.
If you don't have an SMTP service you can set one up with Amazon Simple Email Service (SES):
Server Name, Port, SMTP Username, and SMTP Password values. You'll need these values to configure Mattermost.Domains menu, set up and verify a new domain, then enable Generate DKIM Settings for the domain. We recommend you set up Sender Policy Framework (SPF) and/or Domain Keys Identified Mail (DKIM) for your email domain.[email protected] and select Send a Test Email to verify setup is working correctly.Alternatively, you can use one of the services listed below, or can set up local sendmail by setting Server Name 127.0.0.1 with Port 25.
If deploying Mattermost using Docker, the standard docker 172.16.0.0/12 IP range isn't used. Specify the IP range 192.168.0.0/24 to the email service to avoid relay access errors. If using postfix, under /etc/postfix/main.cf, specify mynetworks = 192.168.0.0/24. This may vary depending on how Mattermost is deployed. Ensure that Port 25 is open if a firewall is present.
Outlook365 no longer supports Basic Auth which is required by Mattermost. We recommend using an alternate Email service like AWS SES (Simple Email Service).
</Note><Note>
- Set Send Email Notifications to true.
- Set the Notification Display Name for the account sending notifications.
- Set Notification Email Address for the email address used to send notifications.
- Enter the SMTP Username, SMTP Password, SMTP Server, and SMTP Port you copied from initial setup.
- We recommend setting Connection Security: to TLS (Recommended) to encrypt communication between Mattermost and your SMTP service.
SMTPPort and related port settings use string format (e.g., "465") for compatibility with the host:port binding format, which requires string concatenation.
Make sure Postfix is installed on the same machine as Mattermost.
Additional configuration is required in Google to allow SMTP email to relay through their servers. See SMTP relay: Route outgoing non-Gmail messages through Google for the required steps.
</Warning> </TabItem> <TabItem value="hotmail" label="Hotmail">If you fill in SMTP Username and SMTP Password then you must set Connection Security to TLS or to STARTTLS
If you have issues with your SMTP install, from your Mattermost team site go to System Console > Logs to look for error messages related to your setup. You can do a search for the error code to narrow down the issue. Sometimes ISPs require nuanced setups for SMTP and error codes can hint at how to make the proper adjustments.
For example, if System Console > Logs displays the following error, search for 554 5.7.1 error and Client host rejected: Access denied.
Connection unsuccessful: Failed to add to email address - 554 5.7.1 <unknown[IP-ADDRESS]>: Client host rejected: Access denied
If an SMTP connection test in the System Console for a self-hosted Mattermost deployment fails with the message Connection unsuccessful: Failed to set the to address: 550 5.7.27 [[email protected]](mailto:[email protected]), go to System Console > Site Configuration > Notifications to verify that notification settings are configured correctly, including Notification Display Name, Notification From Address, Support Email Address, and Notification Reply-To Address. Cloud administrators can't manage Notification From Address or Notification Reply-To Address.
Attempt to Telnet to the email service to make sure the server is reachable. For additional information, visit https://learn.microsoft.com/en-us/exchange/mail-flow/test-smtp-with-telnet?view=exchserver-2019. If you're using an earlier version than Exchange Server 2019, select your version from the left-hand navigation menu.
You must run the following commands from the same machine or virtual instance where mattermost/bin/mattermost is located.
Telnet to the email server with telnet mail.example.com 25. If the command works you should see something like:
Trying 24.121.12.143...
Connected to mail.example.com.
220 mail.example.com NO UCE ESMTP
Then type something like HELO <your mail server domain>. If the command works you should see something like:
250-mail.example.com NO UCE
250-STARTTLS
250-PIPELINING
250 8BITMIME
ping on those, or install Telnet yourself either directly or by modifying the Dockerfile.