Mailgun

App · Email · 4 actions

Send and track emails with Mailgun.

Actions

ActionWhat it does
Get domain statsGet summary statistics for email events, such as delivered or opened, on your Mailgun domain.
List eventsList what happened to emails sent from your Mailgun domain - accepted, delivered, failed (bounced), opened, clicked, unsubscribed or marked as spam - newest first, or oldest first from a time.
Send an emailSend a plain text or HTML email through a Mailgun sending domain.
Send an email with a templateSend an email whose body is one of your Mailgun templates, filling in its {{variables}}.

Get domain stats

Get summary statistics for email events, such as delivered or opened, on your Mailgun domain. Requires a full-access account API key; a domain-restricted Sending key cannot read stats.

Inputs

EventeventtextRequired
The email event to report on.One of: accepted, delivered, failed, opened, clicked, unsubscribed, complained, stored.
Start datestart_datetextRequired
Start date (YYYY-MM-DD).
End dateend_datetextRequired
End date (YYYY-MM-DD).
Group results byresolutiontext
Optional grouping for the results.One of: hour, day, month.

Outputs

statsobject
Stats details.
Example output
{
  "stats": {}
}

List events

List what happened to emails sent from your Mailgun domain - accepted, delivered, failed (bounced), opened, clicked, unsubscribed or marked as spam - newest first, or oldest first from a time. Mailgun keeps events for a few days to a month, depending on your plan. Requires a full-access account API key.

Inputs

Eventeventtext
Only this kind of event. Leave blank for every kind.One of: accepted, delivered, failed (Failed (bounced)), opened, clicked, unsubscribed, complained (Marked as spam).
Recipientrecipienttext
Only events for this recipient's email address.
Fromsincedate and time
Only events from this time on, listed oldest first. Leave blank for the newest first.
How manylimitnumber
How many events to return, from 1 to 300. 50 if left blank.
Next pagepagetext
The next_page value of an earlier 'List events', to read on from there. The other fields are ignored then.

Outputs

resultobject
The events found.
Example output
{
  "result": {
    "count": 1,
    "events": [
      {
        "event": "failed",
        "from": "shop@mg.example.com",
        "id": "czsjqFATSlC3QtAK-C80nw",
        "message_id": "20261107120000.1.ABC@mg.example.com",
        "reason": "No such mailbox",
        "recipient": "ana@example.com",
        "severity": "permanent",
        "subject": "Your order has shipped",
        "tags": [
          "orders"
        ],
        "time": "2026-11-07T12:04:31Z",
        "url": ""
      }
    ],
    "next_page": "WzMsIFsiZiJdLCBbXV0="
  }
}

Send an email

Send a plain text or HTML email through a Mailgun sending domain.

Inputs

From emailfrom_emailtextRequired
Sender email address (must belong to the Mailgun domain).
TototextRequired
Recipient email address or comma-separated list.
SubjectsubjecttextRequired
Subject line for the email.
Body (plain text)texttextRequired
Plain text body.
Body (HTML)htmltext
Optional HTML version of the email body.
CCcctext
Optional CC recipients (comma-separated).
BCCbcctext
Optional BCC recipients (comma-separated).

Outputs

resultobject
Result details.
Example output
{
  "result": {}
}

Send an email with a template

Send an email whose body is one of your Mailgun templates, filling in its {{variables}}.

Inputs

Fromfrom_emailtextRequired
Sender email address (must belong to the Mailgun domain).
TototextRequired
Recipient email address or comma-separated list.
SubjectsubjecttextRequired
Subject line for the email.
TemplatetemplatetextRequired
The Mailgun template to send.
Template valuesvariablesobject
The values to fill the template's {{variables}} with, such as first_name: Ana.
Template versiontemplate_versiontext
Optional. A version of the template to send instead of its active one, by its tag.
CCcctext
Optional CC recipients (comma-separated).
BCCbcctext
Optional BCC recipients (comma-separated).

Outputs

resultobject
What Mailgun said when it took the email.
Example output
{
  "result": {
    "id": "<20261107120000.1.ABC@mg.example.com>",
    "message": "Queued. Thank you."
  }
}

On this page