Start Free
Latest | Instance administration | System functions setup | Notifications

Setting up the email notifications feature

On this page

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 otherwise the notification emails will not redirect to the right SonarQube server URL:

  1. Go to Administration > Configuration > General Settings > General > General.
  2. 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 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

  1. Go to Administration > Configuration > General Settings > Email Notification.
  2. In SMTP Configuration, select Basic Authentication (it's selected by default) and set the parameters as described below.
  3. Select Save configuration.
Parameters (basic authentication)
ParameterDescription
SMTP usernameUsername used to authenticate to the SMTP server.
SMTP passwordPassword 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 hostURL of the SMTP server.
SMTP portPort of the SMTP server (usually 25, 587 or 465).
Security protocolSecurity protocol used to connect to the SMTP server (SSLTLS is recommended). 
From addressAddress from which emails will come.
From nameName from which emails will come (usually "SonarQube").
Subject prefixPrefix 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:

  1. Register an application as explained In this Quickstart guide.
  2. Enable client credentials grant flow for SMTP: see Use client credentials grant flow.
Configuring SMTP modern authentication in SonarQube
  1. Go to Administration > Configuration > General Settings > Email Notification.
  2. In SMTP Configuration, select Modern Authentication and set the parameters as described below.
  3. Select Save configuration.
ParameterDescription
SMTP usernameUsername used to authenticate to the SMTP server.
Authentication hostHost of the Identity Provider issuing access tokens.
Example: https://login.microsoftonline.com/
Client IDClient identifier provided by the Microsoft Exchange when registering the application.
Client SecretClient password provided by Microsoft Exchange when registering the application.
TenantMicrosoft tenant id.
SMTP hostURL of the SMTP server.
Example: smtp.office365.com
SMTP portPort of the SMTP server (usually 25, 587 or 465).
Security protocolSecurity protocol used to connect to the SMTP server.
From addressAddress from which emails will come.
From nameName from which emails will come (usually "SonarQube").
Subject prefixPrefix 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:

  1. Set the sonar.notifications.delay property (in seconds) in <sonarqubeHome>/conf/sonar.properties
  2. Restart the server for the new value to be taken into account.

Was this page helpful?

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License