Setting up your mail server
Setting up Bitbucket Data Center and Server to use your SMTP mail server:
- allows Bitbucket to send notifications about events to do with commit discussions, pull requests and repositories. Note that if the mail server fails, notifications will be dropped.
- allows Bitbucket to email a link to a newly created user, which the user can use to generate their own password.
- allows a user to reset their password if they forget it.
See Supported platforms for the mail clients supported by Bitbucket.
Hostname
The hostname of the mail server (for example "localhost" or "192.168.1.15").
Port
The port of the mail server (if unspecified, the port 25 will be used).
Username
The username to use to connect to the mail server.
Password
The password to use to connect to the mail server.
Protocol
Use either SMTP or SMTPS when connecting to the mail server.
When using SMTP, you can specify that:
- SSL/TLS is used if supported by the mail server, otherwise mail is sent in plaintext.
- mail should only be sent if the mail server supports SSL/TLS.
See Securing email notifications below.
Use SSL/TLS if available
If the SMTP server supports the STARTTLS extension this will be used to encrypt mail with SSL/TLS otherwise plaintext will be used. SMTPS servers always support SSL/TLS.
Always use SSL/TLS
If the SMTP server does not support the STARTTLS extension mail will not be sent. SMTPS servers always support SSL/TLS.
Email from
Specifies the 'From' header in notification emails (for example: noreply@yourcompany.com).
Send a test email
Enter an email address to send a test email to check that the mail server is configured correctly.
Anonymous user
If you wish to set up the outgoing mail server as an anonymous user, simply leave the username and password fields empty. However, in Chrome, these fields may be auto-populated, leading to an error – as a workaround, try using a different browser.
Securing email notifications
Bitbucket 3.6 and later versions support the following protocols:
- SMTP, where mail is not encrypted.
- SMTP encrypted by SSL/TLS using the STARTTLS extension, where the protocol conversation is upgraded only if SSL/TLS is supported by the mail server, but otherwise remains as plaintext.
- SMTP, where STARTTLS support is required on the mail server, otherwise mail is not sent.
- SMTPS (where the whole protocol conversation uses SSL/TLS).
Note that if you use either SMTP with STARTTLS, or SMTPS, and connect to a self-signed mail server, you may need to import the server's cert ificate and set up a custom cacerts file for Bitbucket (just as you do for any outbound SSL/TLS connection to a self-signed server). See this Bitbucket knowledge base article for information about how to do that.
Configuring the mail server to use Gmail
If you wish to connect to a Gmail account for email notifications in Bitbucket, refer to the Configuring the Mail Server to Use Gmail guide.
In particular, note that Gmail won't show images in the email because of the way that Google loads images on their servers. For Google Apps, a Bitbucket administrator can solve the problem by adding the Bitbucket domain name to a whitelist – see https://support.google.com/a/answer/3299041?hl=en for more information.