Include artifacts in Team City E-Mail Notifier

If you have admin access to teamcity server, you can easily update the default email notification template to include artifacts of a build. This is how I did it.

Step1: Navigate to Team City _notifications folder. (in my case it was C:\ProgramData\JetBrains\TeamCity\config\_notifications\email)

Step2: Add below lines to build_failed.ftl and build_successful.ftl

<p>Build artifacts:</p>
  <#list build.artifactsDirectory.listFiles() as file>
    <a href="${webLinks.getDownloadArtefactUrl(build.buildTypeExternalId, build.buildId,}">${}</a> (${file.length()}B)<br/>
Step3: Push a build and check your email 😉
This is how build_successful.ftl looked like after the addition.

<#– Uses FreeMarker template syntax, template guide can be found at –>

<#import “common.ftl” as common>
<#import “responsibility.ftl” as resp>

<#global subject>[<@common.subjMarker/>, SUCCESSFUL] Build ${project.fullName} :: ${} <@common.short_build_info build/></#global>

<#global body>Build ${project.fullName} :: ${} <@common.short_build_info build/> successful ${var.buildShortStatusDescription}.
<@resp.buildTypeInvestigation buildType true/>
Agent: ${agentName}
Build results: ${link.buildResultsLink}


<#global bodyHtml>

Build ${project.fullName?html} :: ${} successful

<p>Build artifacts:</p>
<#list build.artifactsDirectory.listFiles() as file>
<a href=”${webLinks.getDownloadArtefactUrl(build.buildTypeExternalId, build.buildId,}”>${}</a> (${file.length()}B)<br/>
<@common.build_agent build/>
<@common.build_comment build/>
<@common.build_changes var.changesBean/>
<@common.compilation_errors var.compilationBean/>
<@common.test_errors var.failedTestsBean/>

and here is a sample email containing build artifacts.

Build artifacts:
.teamcity (0B)
Project Report.pdf (2992569B)
Agent: Agent007

Link to TeamCity Documentation