Email SMTP setup, notification rules for failures and fixes, branch filters, Freemarker templates for custom emails, Slack integration via webhook, and build status badges
| Notifier | Availability | Notes |
|---|---|---|
| Built-in | Requires SMTP server configuration. Most commonly used. | |
| Jabber/XMPP | Built-in | Instant messaging via XMPP protocol. Rarely used today. |
| IDE (IntelliJ, Eclipse) | Built-in (requires plugin) | Notifications in IDE status bar. Requires developer to install TC IDE plugin. |
| Windows system tray | Built-in (Windows only) | Popup notifications in Windows system tray. |
| Slack | Via custom notifier / webhook | Not built-in — implemented via Command Line step or build feature. See section 12.7. |
| Field | Example |
|---|---|
| SMTP host | smtp.gmail.com or internal SMTP server |
| SMTP port | 587 (TLS/STARTTLS) or 465 (SSL) or 25 (plain) |
| Send email from | teamcity@yourcompany.com |
| Login | SMTP username (often same as from address) |
| Password | SMTP password or app password |
| Secure connection | STARTTLS (port 587) or SSL (port 465) |
Click Test connection — TeamCity sends a test email to the admin address. Verify it arrives before saving.
If using Gmail, your Google account must have 2FA enabled, and you need to create an App Password (Google Account → Security → App passwords). The regular Gmail password won't work — Google blocks "less secure app" access. The App Password is a 16-character code used only for TeamCity.
Notification rules define WHO gets notified WHEN. They can be set at the user level (My Settings & Tools → Notification Rules) or at the group level.
| Event | Fires when | Recommended for |
|---|---|---|
| Build failed | Any build in the rule's scope fails | All developers on the team |
| First build failure | A build fails AFTER a successful build (new failure) | Reduced noise — only alerts on newly broken builds |
| Build successful | Any build passes | Usually too noisy — avoid for active repos |
| Build fixed | A build passes AFTER having failed | The person who fixed it, or the whole team |
| Build starts | Any build enters the running state | Very noisy — rarely used |
| Probably hanging | Build exceeds its expected duration threshold | On-call team — stuck build detection |
| Responsibility changed | A developer is assigned as "responsible" for a failure | The assigned developer |
For most developers: Email on First build failure + Build fixed on the main branch only. This gives you one email when main breaks and one when it's fixed — without a flood of feature-branch failure emails. Feature branch failures should be the developer's own responsibility to check.
| Level | Who configures it | Scope |
|---|---|---|
| User level | Each user in their own profile | Applies only to that user |
| Group level | System or project admin | Applies to all users in the group; users can add their own rules on top |
Group-level rules are useful for ensuring the whole team gets notified of main branch failures without requiring every developer to configure their own rules. Go to Administration → User Groups → <Group> → Notification Rules.
In a notification rule, add a branch filter to limit notifications to specific branches. Same +/- syntax as VCS Root branch specs:
# Notify only for main and release branches
+:refs/heads/main
+:refs/heads/release/*
# Notify for everything except feature branches
+:refs/heads/*
-:refs/heads/feature/*
TeamCity's email notification content is defined by Freemarker templates stored in the data directory at <Data Dir>/config/notification/email/. You can customise the subject and body.
# Default template location:
<TC Installation>/webapps/ROOT/WEB-INF/BSPTags/email/*.ftl
# To customise without modifying the installation:
# Copy to: <Data Dir>/config/notification/email/
# Edit there — TeamCity uses these over the defaults.
# Example: customise failure email subject
# File: <Data Dir>/config/notification/email/build_failed.ftl
Subject: [TC] FAILED: ${build.buildType.fullName} #${build.buildNumber} on ${build.branch.name!"default"}
# Available template variables include:
# ${build} — the build object (status, number, branch, params)
# ${buildType} — the build configuration
# ${project} — the project
# ${changes} — list of VCS changes
# ${firstFailedBuild} — the first build that introduced the failure
TeamCity 2017.2.2 has no built-in Slack notifier. Implement it with a Command Line build step that posts to a Slack incoming webhook, set to run "even if previous steps failed."
env.SLACK_WEBHOOK_URL.#!/bin/bash
# Slack notification step (execute: even if previous steps failed)
STATUS="$BUILD_STATUS"
COLOR="good"
if [ "$STATUS" = "FAILURE" ]; then COLOR="danger"; fi
if [ "$STATUS" = "SUCCESS" ]; then COLOR="good"; fi
PAYLOAD=$(cat <<EOF
{
"attachments": [{
"color": "$COLOR",
"title": "$BUILD_CONFIGURATION: #$BUILD_NUMBER",
"title_link": "${TEAMCITY_SERVER_URL}/viewLog.html?buildId=${BUILD_ID}",
"text": "Branch: ${BUILD_BRANCH}\nStatus: $STATUS",
"footer": "TeamCity"
}]
}
EOF
)
curl -s -X POST -H 'Content-type: application/json' \
--data "$PAYLOAD" "$SLACK_WEBHOOK_URL"
Parameters used: %teamcity.build.status%, %build.number%, %teamcity.build.branch%, %build.id%, %teamcity.serverUrl% — these are standard predefined parameters from Phase 8.
TeamCity generates a status badge image you can embed in GitHub READMEs or wikis.
# Badge URL format:
http://YOUR_TC_SERVER/app/rest/builds/buildType:(id:BuildConfigId)/statusIcon
# For HTTPS server:
https://ci.yourcompany.com/app/rest/builds/buildType:(id:BackendServices_Build)/statusIcon
# Embed in GitHub README.md:
[/statusIcon)](https://ci.yourcompany.com/viewType.html?buildTypeId=BackendServices_Build)
# Optional: filter to specific branch
https://ci.yourcompany.com/app/rest/builds/buildType:(id:BackendServices_Build),branch:(name:main)/statusIcon
The status badge URL requires authentication unless Guest User is enabled on the TeamCity server (Phase 13). For private servers showing badges on public GitHub repos, enable Guest User with read-only access limited to the specific project. Without this, the badge will show an authentication error icon.