Skip to content

About

Official GitHub Action for sending email through the Elastic Email REST API v4. Notify your team when a workflow succeeds, fails or is cancelled, with ready-made HTML or plain-text templates, custom bodies and multiple recipients.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Elastic Email

Elastic Email Send Email Action

The official GitHub Action for sending email notifications from your workflows through the Elastic Email REST API v4.

GitHub Action Node.js API Test License: MIT

Latest release Last commit Open issues GitHub stars

Setup • Quick start • Inputs • Examples • Contributing


Features

  • Workflow notifications. Email your team when a build, test or deploy succeeds, fails or is cancelled.
  • Ready-made templates. If you don't pass a body, the action writes one for you, in HTML or plain text, with the repository, workflow, actor, ref and a link to the run.
  • Custom content. Pass your own body in HTML or plain text, with any ${{ }} expressions you need.
  • Multiple recipients. Send to a comma-separated list of addresses in one step.
  • Transaction ID output. The action sets message_id, so you can look up delivery in your Elastic Email dashboard or use it in later steps.
  • No extra setup. It runs on the node24 runtime from a bundled dist/. There's no Docker image and no install step.

Requirements

Requirement Details
Runner Any GitHub-hosted or self-hosted runner that supports node24 actions
Elastic Email account An API key with Send HTTP access
Sender A from_email on a domain you've verified in Elastic Email

Setup

1. Create an API key

In your Elastic Email account, open API settings and create a key. For this action it only needs Send HTTP access.

2. Store it as a GitHub secret

In your repository, go to Settings → Secrets and variables → Actions → New repository secret, name it ELASTIC_EMAIL_API_KEY and paste the key.

Tip

Keep the key in secrets only. Never write it into a workflow file, a body or a log line.

Quick start

Notify on failure

name: CI

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run tests
        run: npm test

      - name: Email the team if the build fails
        if: failure()
        uses: ElasticEmail/elasticemail-send-email-action@v1
        with:
          api_key: ${{ secrets.ELASTIC_EMAIL_API_KEY }}
          from_email: ci@yourdomain.com
          to: dev-team@yourdomain.com
          subject: "❌ Build failed: ${{ github.repository }}"
          status: failure

Always notify, with the job's real status

      - name: Deployment notification
        if: always()
        uses: ElasticEmail/elasticemail-send-email-action@v1
        with:
          api_key: ${{ secrets.ELASTIC_EMAIL_API_KEY }}
          from_email: deploy@yourdomain.com
          from_name: Deployment Bot
          to: team@yourdomain.com, manager@yourdomain.com
          subject: "Deployment ${{ job.status }}: ${{ github.repository }}"
          status: ${{ job.status }}

Custom body

      - name: Custom notification
        uses: ElasticEmail/elasticemail-send-email-action@v1
        with:
          api_key: ${{ secrets.ELASTIC_EMAIL_API_KEY }}
          from_email: ci@yourdomain.com
          to: notifications@yourdomain.com
          subject: Release ${{ github.ref_name }} published
          status: success
          body_type: PlainText
          body: |
            Hello team,

            "${{ github.workflow }}" finished for ${{ github.repository }}.
            Triggered by: ${{ github.actor }}

            Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

Use the transaction ID

      - name: Send email
        id: email
        uses: ElasticEmail/elasticemail-send-email-action@v1
        with:
          api_key: ${{ secrets.ELASTIC_EMAIL_API_KEY }}
          from_email: ci@yourdomain.com
          to: user@yourdomain.com
          subject: Test
          status: success

      - name: Print transaction ID
        env:
          MESSAGE_ID: ${{ steps.email.outputs.message_id }}
        run: echo "Sent, transaction ID $MESSAGE_ID"

Inputs

Input Required Default Description
api_key ✅ Elastic Email API key. Pass it from a secret.
from_email ✅ Sender address. Its domain must be verified in your Elastic Email account.
to ✅ Recipient address, or a comma-separated list.
subject ✅ Email subject line.
status ✅ Workflow status: success, failure or cancelled. Sets the colour and label of the generated template. ${{ job.status }} works.
body_type HTML HTML or PlainText.
body generated Your own email body. If empty, the action generates one from status and the run's context.
from_name GitHub Actions Sender display name.

Outputs

Output Description
message_id The Elastic Email transaction ID of the sent email.

More examples

More complete, runnable samples are in the Elastic Email examples repository. It covers transactional email, SMTP, webhooks, inbound email, contacts and serverless platforms across 20+ languages and frameworks.

More workflow snippets
Scenario Condition status
Success only if: success() success
Failure only if: failure() failure
Cancelled runs if: cancelled() cancelled
Every run if: always() ${{ job.status }}
      - name: Notify on cancel
        if: cancelled()
        uses: ElasticEmail/elasticemail-send-email-action@v1
        with:
          api_key: ${{ secrets.ELASTIC_EMAIL_API_KEY }}
          from_email: ci@yourdomain.com
          to: alerts@yourdomain.com
          subject: "⚠️ Workflow cancelled: ${{ github.workflow }}"
          status: cancelled

Authentication

Header Sent by Used for
X-ElasticEmail-ApiKey The action, on its one API call Your api_key input, sent to POST /v4/emails/transactional

GitHub masks secrets in logs, and the action never prints the key.

API limits

The action sends one request to the Elastic Email API v4 per step, with a 30 second timeout. Your account's sending limits and the API's limits apply:

  • Up to 20 concurrent connections per account
  • A request with no response for about 50 seconds fails on the API side with a gateway error (5xx)

Troubleshooting

"Bad request: APIKey Expired" or "Invalid API key"

The API didn't accept the key. Check that the ELASTIC_EMAIL_API_KEY secret holds the full key, that the key hasn't been revoked or expired, and that it has Send HTTP access. Secrets aren't passed to workflows triggered from forks.

"Invalid recipient email format"

One of the addresses in to isn't valid. Check for typos, and separate multiple addresses with commas: a@example.com, b@example.com.

The sender is rejected

from_email must use a domain you've verified in Elastic Email. Verify the domain or pick an address on one that is.

The step succeeds but no email arrives

Check the spam folder, then look up the message_id in your Elastic Email dashboard to see its delivery status. Make sure your account has credits left.

Development

npm ci
npm test               # Jest
npm run test:coverage  # coverage report in coverage/
npm run build          # bundles index.js into dist/ with @vercel/ncc

GitHub runs dist/index.js directly, so commit the rebuilt dist/ with every source change. CI fails if it's out of date. To try the action against the real API, run the Send test email workflow from the Actions tab. It needs the ELASTIC_EMAIL_API_KEY secret.

Versioning

Releases follow semantic versioning and are listed in GitHub Releases. Pin @v1 to get fixes and features within the major version, or pin an exact tag such as @v1.0.0.

Build details
  • API version: 4.0.0 (POST /v4/emails/transactional)
  • Action runtime: node24
  • Dependencies: @actions/core, axios
  • Bundler: @vercel/ncc

Contributing

Contributions are welcome! Please read CONTRIBUTING.md before opening a pull request.

This project follows the Contributor Covenant Code of Conduct.

Support

Important

The fastest way to get help is the chat widget on elasticemail.com. Our support team can help with your account, sending, deliverability and API questions.

License

Released under the MIT License. Copyright © 2025–2026 Elastic Email.

About

Official GitHub Action for sending email through the Elastic Email REST API v4. Notify your team when a workflow succeeds, fails or is cancelled, with ready-made HTML or plain-text templates, custom bodies and multiple recipients.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages