> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Demo Email Extension Notification Freestyle

> Guide to installing and configuring Jenkins Email Extension plugin for Freestyle jobs including SMTP setup, templates, triggers, recipients, attachments, and troubleshooting.

The Email Extension (Email‑ext) plugin for Jenkins replaces the built-in email notifier and gives you fine-grained control over:

* when emails are sent (triggers),
* who receives them (recipient options and tokens), and
* the exact email content (HTML, templates, attachments, and scripts).

This guide shows how to install the plugin, configure system-wide defaults (SMTP, content type, recipients, templates), and set up job-level notifications for Freestyle jobs — including how to attach build logs and troubleshoot empty-recipient errors.

Install the plugin and restart Jenkins after installation. The plugin documentation includes additional examples and configuration notes.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-extension-plugin-dark-screenshot.jpg?fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=14e4c0e47a33cb8650f1ec04d4f10697" alt="Screenshot of the Jenkins &#x22;Email Extension&#x22; plugin page in a dark theme, showing documentation links and feature sections on the left and version/installation stats and links on the right. The top has Jenkins navigation and tabs for Documentation, Releases, Issues, Dependencies, and Health Score." width="1920" height="1080" data-path="images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-extension-plugin-dark-screenshot.jpg" />
</Frame>

## System-wide configuration

1. Open Manage Jenkins → Configure System and search for "Extensible" to find the **Editable Email Notification** section.
2. Configure SMTP and authentication:
   * SMTP server: `smtp.gmail.com`
   * Port: `465` (SSL) or `587` (TLS)
   * Add credentials (username/password or App Password) via Jenkins Credentials, then click Advanced to choose SSL/TLS and other options.

Callouts and security notes:

<Callout icon="lightbulb" color="#1CB2FE">
  If you use Gmail, enable 2‑step verification and create an App Password for Jenkins. Do not use your normal account password.
</Callout>

Below is a quick reference for common SMTP settings:

| Provider | SMTP server | SSL/TLS port | Notes |
| - | -: | -: | - |
| Gmail | `smtp.gmail.com` | `465` (SSL) or `587` (TLS) | Use an `App Password` (requires 2‑step verification) |
| Generic SMTP | `<your-smtp-host>` | `25`, `465`, or `587` | Consult your mail provider for exact settings |

## Default content type and recipients

You can set global defaults that jobs inherit:

* Default Content Type: Plain Text or HTML
* Default Recipients: comma-separated emails (available as the token `\$DEFAULT_RECIPIENTS`)
* Default Reply‑To, Default Subject, Default Body.

Set Default Content Type to `HTML` if you want richer email formatting.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-default-content-type.jpg?fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=32553e81afe78c562ea93e71115a1bda" alt="A dark-themed browser window showing the Jenkins &#x22;Manage Jenkins > System&#x22; configuration page, specifically the email settings with the &#x22;Default Content Type&#x22; dropdown open (Plain Text selected) and fields for default user e-mail suffix and recipients. Save and Apply buttons are visible at the bottom." data-og-width="1920" width="1920" data-og-height="1080" height="1080" data-path="images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-default-content-type.jpg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-default-content-type.jpg?w=280&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=b9572192a753997eb52983fa2b29213b 280w, https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-default-content-type.jpg?w=560&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=82accd75c2e801d2aabf66808914227d 560w, https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-default-content-type.jpg?w=840&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=378213d779c4eae1d78392c5b3070426 840w, https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-default-content-type.jpg?w=1100&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=e06728d537d3ae478b6ebf17aebff54c 1100w, https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-default-content-type.jpg?w=1650&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=273db894df53590480fdbdf472ecf107 1650w, https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-default-content-type.jpg?w=2500&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=9ad9866b3f8d4390feabc393aea98895 2500w" />
</Frame>

Some additional fields and examples:

* List-ID examples (keep values in code if they contain angle brackets):

```text theme={null}
<ci-notifications.company.org>
Build Notifications <ci-notifications.company.org>
"Build Notifications" <ci-notifications.company.org>
```

* Default recipients: a comma-separated list of email addresses. When present, jobs can reference them using `\$DEFAULT_RECIPIENTS` and `\$DEFAULT_REPLYTO`.

Use this simple shell snippet to intentionally fail a job for testing email triggers:

```bash theme={null}
echo "Updating job config using Jenkins CLI"
node -v
npm -v
exit 1
```

## Default subject and body templates

Email‑ext supports tokens/variables. Common system defaults:

Default subject:

```text theme={null}
$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
```

Default body:

```text theme={null}
$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
Check console output at $BUILD_URL to view the results.
```

## Attachments and limits

You can attach files (for example, the build log). The attachment size limit can be left blank or set to `-1` to indicate no limit. Options include compressing the log or attaching the raw `build.log`.

## Triggers and default behavior

Email‑ext ships with multiple triggers (e.g., "Failure - Any"). Important behavior to know:

* Some triggers (like "Send to Developers" or "Send to Culprits") only include those groups and do not automatically include `\$DEFAULT_RECIPIENTS` unless the trigger is explicitly configured to do so.
* If a trigger is evaluated but no recipients are selected, the plugin will skip sending.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-manage-system-notifications.jpg?fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=162224f0277a630f76f07a3e87c4a35e" alt="A dark-themed screenshot of the Jenkins &#x22;Manage Jenkins > System&#x22; configuration page showing a list of notification trigger checkboxes (e.g., Failure - Any is checked). The bottom shows &#x22;Content Token Reference&#x22; and Save/Apply buttons." data-og-width="1920" width="1920" data-og-height="1080" height="1080" data-path="images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-manage-system-notifications.jpg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-manage-system-notifications.jpg?w=280&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=7272ef702cf03d96e8ae51d20f855fce 280w, https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-manage-system-notifications.jpg?w=560&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=fa0d0ec56f01ab5608efea128f4cccc7 560w, https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-manage-system-notifications.jpg?w=840&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=ddf437f9c8ba3869efea7fcfdb56e470 840w, https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-manage-system-notifications.jpg?w=1100&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=09663b552d1a39c6cc4b835ab4488f22 1100w, https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-manage-system-notifications.jpg?w=1650&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=c580606eb4c975fb35d8ac8d25433022 1650w, https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-manage-system-notifications.jpg?w=2500&fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=99e567769b5653870c8e7688a0fcca3a 2500w" />
</Frame>

## Job-level configuration (Freestyle job)

1. Open the job (e.g., `npm-version-test`) → Configure.
2. In Post‑build Actions, remove any older/in-built Email‑ext entry if present, then add **Editable Email Notification**.
3. For the project recipient list you can:
   * Add explicit comma-separated email addresses, or
   * Leave blank and rely on `\$DEFAULT_RECIPIENTS` (if your trigger includes it), or
   * Configure recipients per-trigger (recommended when using group options like Developers/Culprits).

If the job runs the failing shell snippet above and you see this log message:

```text theme={null}
An attempt to send an e-mail to empty list of recipients, ignored.
```

it means a trigger evaluated to send email but no recipients were actually selected for that trigger (either project recipients are empty and the trigger is set to send only to Developers/Culprits, or defaults were not picked up by that trigger).

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-extension-default-recipients.jpg?fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=43ca58da4241f57be0716ef34e629d07" alt="A dark-themed Jenkins &#x22;Manage Jenkins → System&#x22; configuration page showing Email Extension settings, with the &#x22;Default Recipients&#x22; field highlighted and containing an email address. Save and Apply buttons are visible at the bottom." width="1920" height="1080" data-path="images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-email-extension-default-recipients.jpg" />
</Frame>

<Callout icon="warning" color="#FF6B6B">
  If you leave the project recipient list empty and use a trigger that only targets Developers/Culprits, email will not be sent to your `\$DEFAULT_RECIPIENTS` unless you explicitly include that token in the trigger or project recipients.
</Callout>

### Fix: add recipients for the trigger

In the job's post-build action for a specific trigger (for example, Failure - Any), add one of the following:

* explicit email addresses (comma-separated),
* the token `\$DEFAULT_RECIPIENTS`,
* or select one of the provided recipient options (Send To Developers, Send To Culprits, Build User, etc.).

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-post-build-email-recipients.jpg?fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=f40ca502d9d203fc14f69afa98158c15" alt="A dark-themed Jenkins job configuration screen showing the &#x22;Post-build Actions&#x22; section with an open dropdown of email recipient options (e.g., Build User, Culprits, Developers) from the Email Extension plugin. The page includes Save/Apply buttons and a left navigation with sections like General and Build Triggers." width="1920" height="1080" data-path="images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/jenkins-post-build-email-recipients.jpg" />
</Frame>

After adding recipients and re-running the job, the console should show the plugin sending the email, for example:

```text theme={null}
Email was triggered for: Failure - Any
Sending email for trigger: Failure - Any
Sending email to: sid.live.demos@gmail.com
```

## Email content, templates, and attachments

* The job uses the system default subject/body unless you override them at the project level.
* You can provide HTML bodies or custom templates per job.
* Attach the build log via the plugin UI or use presend/postsendscripts:

```text theme={null}
$DEFAULT_PRESEND_SCRIPT
$DEFAULT_POSTSEND_SCRIPT
```

* Optionally compress logs before attaching.

The sent message will include the configured subject/body and attachments (for example, `build.log`) when enabled.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/eoiWanmIVF-indgd/images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/gmail-npm-version-test-build14-failing.jpg?fit=max&auto=format&n=eoiWanmIVF-indgd&q=85&s=7ac487b9a7addd7f1763741be9446f5e" alt="An open Gmail message with the subject &#x22;npm-version-test - Build #14 - Still Failing!&#x22; showing a build.log attachment. The email body includes a link to a Jenkins job (localhost)." width="1920" height="1080" data-path="images/Certified-Jenkins-Engineer/Automation-and-Security/Demo-Email-Extension-Notification-Freestyle/gmail-npm-version-test-build14-failing.jpg" />
</Frame>

## Tokens and common variables

| Token | Meaning |
| - | - |
| `\$PROJECT_NAME` | Jenkins project/job name |
| `\$BUILD_NUMBER` | Build number |
| `\$BUILD_STATUS` | Build result (SUCCESS/FAILURE/etc.) |
| `\$BUILD_URL` | URL to the build console |
| `\$DEFAULT_RECIPIENTS` | System default recipients configured in Manage Jenkins |
| `\$DEFAULT_REPLYTO` | System default reply-to address |

## Summary / Checklist

* Install Email Extension plugin and restart Jenkins.
* Configure SMTP and credentials (Gmail users: create an App Password).
* Set system defaults: content type (HTML vs Plain), `\$DEFAULT_RECIPIENTS`, subject, body, and attachment limits.
* For each job, add an **Editable Email Notification** in Post-build Actions.
* Ensure the triggers include recipients explicitly (project list, `\$DEFAULT_RECIPIENTS`, or recipient groups such as Developers/Culprits).
* Enable attachments, use presend/postsend scripting if needed, and customize HTML/template content as required.

Further reading and references:

* Email Extension plugin: [https://plugins.jenkins.io/email-ext](https://plugins.jenkins.io/email-ext)
* Gmail App Passwords: [https://support.google.com/accounts/answer/185833?hl=en](https://support.google.com/accounts/answer/185833?hl=en)

That's all for this guide — advanced templating and scripting examples are outside this article's scope.

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/certified-jenkins-engineer/module/4d6d1f39-307c-4fdb-8d2b-834c1650e792/lesson/4a7cb49b-4855-43ed-93ae-4578cc6eb23b" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.