Setting up the email notifications feature
Email notifications are sent to users on particular predefined events and on analysis-related events they have subscribed to. You cannot subscribe to notifications for another user. If you believe a user should be receiving notifications, then you must notify the user that they should subscribe.
Prerequisites
Make sure that the server URL is properly set in SonarQube Server otherwise the notification emails will not redirect to the right SonarQube Server URL:
- Go to Administration > Configuration > General Settings > General > General.
- Check the Server base URL parameter.
Configuring the SMTP authentication
Two SMTP authentication modes are supported: basic and modern authentication. Currently, modern authentication is supported in SonarQube Server only with the Microsoft email service provider (Microsoft Exchange). When using Microsoft Exchange, modern authentication (using OAuth 2.0 token-based authorization) is highly recommended for security reasons.
Configuring SMTP basic authentication
- Go to Administration > Configuration > General Settings > Email Notification.
- In SMTP Configuration, select Basic Authentication (it's selected by default) and set the parameters as described below.
- Select Save configuration.
Parameters (basic authentication)
Parameter | Description |
---|---|
SMTP username | Username used to authenticate to the SMTP server. |
SMTP password | Password used to authenticate to the SMTP server. Note: If you use a Gmail SMTP server, you must use a Google app password: see this Google article. |
SMTP host | URL of the SMTP server. |
SMTP port | Port of the SMTP server (usually 25, 587 or 465). |
Security protocol | Security protocol used to connect to the SMTP server (SSLTLS is recommended). |
From address | Address from which emails will come. |
From name | Name from which emails will come (usually "SonarQube"). |
Subject prefix | Prefix added to email subject so they can be easily recognized (usually "[SonarQube]"). |
Configuring SMTP modern authentication
You can use SMTP modern authentication only with a Microsoft Exchange server.
Setting up your Microsoft Exchange application
This paragraph is meant to help you understand how to set up your Microsoft Exchange application if you haven’t already.
Proceed as follows:
- Register an application as explained In this Quickstart guide.
- Enable client credentials grant flow for SMTP: see Use client credentials grant flow.
Configuring SMTP modern authentication in SonarQube Server
- Go to Administration > Configuration > General Settings > Email Notification.
- In SMTP Configuration, select Modern Authentication and set the parameters as described below.
- Select Save configuration.
Parameter | Description |
---|---|
SMTP username | Username used to authenticate to the SMTP server. |
Authentication host | Host of the Identity Provider issuing access tokens. Example: https://login.microsoftonline.com/ |
Client ID | Client identifier provided by the Microsoft Exchange when registering the application. |
Client Secret | Client password provided by Microsoft Exchange when registering the application. |
Tenant | Microsoft tenant id. |
SMTP host | URL of the SMTP server. Example: smtp.office365.com |
SMTP port | Port of the SMTP server (usually 25, 587 or 465). |
Security protocol | Security protocol used to connect to the SMTP server. |
From address | Address from which emails will come. |
From name | Name from which emails will come (usually "SonarQube"). |
Subject prefix | Prefix added to email subject so they can be easily recognized (usually "[SonarQube]"). |
Setting the notification queue processing frequency
You can change the frequency with which the SonarQube Server processes the notification queue. To do so:
- Set the
sonar.notifications.delay
property (in seconds) in<sonarqubeHome>/conf/sonar.properties
. - Restart the server for the new value to be taken into account.
Related pages
Was this page helpful?