I would like to send email notifications as a task in my Azure DevOps build so that I can copy the build to other team projects and have it work automatically. I don't want to setup notifications for every new project I create. Thanks!
4 Answers
You can install the Send Email task from the marketplace, and add it to your build pipline.
The extension takes care of sending email within your build or release pipeline.
But better way is configure a global notification settings for the builds.

- 36,824
- 16
- 89
- 114
-
Thanks @Shayki_Abramczyk! How do you configure a global notification setting? – LeWoody Jan 03 '19 at 15:56
-
3Check here: https://learn.microsoft.com/en-us/azure/devops/notifications/howto-manage-team-notifications?view=vsts&tabs=new-nav – Shayki Abramczyk Jan 06 '19 at 18:13
-
This extension did not work for me. It cannot connect to our SMTP server. – dcp Dec 09 '20 at 14:43
-
Only works for Windows agents – gabopushups Mar 02 '23 at 19:48
I tried to use "Send Email" to send something from my gmail but it didn't work out. I got the error message below
The SMTP server requires a secure connection or the client was not authenticated.
If you have a similar problem, I recommend you using SendGrid. It's more easier.
- Just create a resource "SendGrid" on Azure Portal.
- Create an API Key from SendGrid.
- Configure the pipeline with the key.
That's it. You don't have to config any SMTP setting and figure out what it is.

- 1,714
- 1
- 14
- 17
-
-
What do you mean "just create a SendGrid" - there's no such option. I see something called "Twilio Sendgrid" but it wants me to "subscribe", or something. – pabrams Jul 04 '23 at 23:39
For an alternative solution, you can try CatLight notification tool.
It will show desktop alerts about build and release problems, as well as new PRs and work items.
You can configure a shared dashboard for the team, and select all relevant projects and pipelines there. After that, the team members will be notified about failed builds and releases. Team members can also update those monitoring settings themselves at any time.
Azure DevOps can send too many notifications, and when developers check their inbox, many of those notifications are outdated. So, after a while they configure filters to hide them, defeating the purpose of notifications in the first place. CatLight has a dashboard that will show a summary of active alerts, and they will disappear from it as soon as alert is resolved. So it will be less noisy, and harder to ignore than emails.
The tool is free for small teams and open-source, and their is paid version for companies.

- 12,464
- 3
- 46
- 67
You can use the below PowerShell script to send email to a limited audience under the same project.
## fill out these only 5 places in the following script
$myorg = “your-org-onADo”
$myproj = “your-project-onADo”
$sendmailto = “user1@OrgEmailUnderThatProject.com,user1@OrgEmailUnderThatProject.com” ## email of receivers separated by coma
$mysubject = “This is your emails subject line”
$mailbody = “This will be your emails body”
#########################
##getting tfsids for the user under receivers list
$mailusers = “$sendmailto”
$mymailusers = $mailusers -split “,”
$pat = “Bearer $env:System_AccessToken”
$myurl =”https://dev.azure.com/${myorg}/_apis/projects/${myproj}/teams?api-version=5.1"
$data = Invoke-RestMethod -Uri “$myurl” -Headers @{Authorization = $pat}
$myteams = $data.value.id
##create list of members in all teams
$myusersarray = @()
foreach($myteam in $myteams) {
$usrurl = “https://dev.azure.com/${myorg}/_apis/projects/${myproj}/teams/"+$myteam+"/members?api-version=5.1"
$userdata = Invoke-RestMethod -Uri “$usrurl” -Headers @{Authorization = $pat}
$myusers = $userdata.value
foreach($myuser in $myusers) {
$myuserid = $myuser.identity.id
$myusermail = $myuser.identity.uniqueName
$myuserrecord = “$myuserid”+”:”+”$myusermail”
$myusersarray += $myuserrecord
}
}
## filter out all unique users
$myfinalusersaray = $myusersarray | sort -Unique
## create here the final hash of emails and tfsids
$myusershash = @{}
for ($i = 0; $i -lt $myfinalusersaray.count; $i++)
{
$myusershash[$myfinalusersaray[$i].split(“:”)[1]] = $myfinalusersaray[$i].split(“:”)[0]
}
##
## create the list of tfsid of mailers
foreach($mymail in $mymailusers) {
$myto = $myto +’”’+$myusershash[$mymail]+’”,’
}
##send mail using below API
$uri = “https://${myorg}.vsrm.visualstudio.com/${myproj}/_apis/Release/sendmail/$(RELEASE.RELEASEID)?api-version=3.2-preview.1"
$requestBody =
@”
{
“senderType”:1,
“to”:{“tfsIds”:[$myto]},
“body”:”${mailbody}”,
“subject”:”${mysubject}”
}
“@
Try {
Invoke-RestMethod -Uri $uri -Body $requestBody -Method POST -Headers @{Authorization = $pat} -ContentType “application/json”
}
Catch {
$_.Exception
}

- 51
- 5