---
title: Integrate Mailgun with Infoveave
description: Retrieve events and messages from Mailgun for email analytics, logging, or automation.
category: Application
tags: [mailgun, email, messaging, events, integration]
---

# Mailgun

## Description

[**Mailgun**](https://www.mailgun.com/) is a cloud-based email service used to send, receive, and track emails via RESTful APIs. It supports advanced features like email routing, validation, and analytics at scale.

The **Mailgun** activity integrates with the Mailgun API to retrieve email events or stored messages. It supports two primary entities:

- **Events** – Track email delivery, opens, clicks, failures, and related metadata.
- **Messages** – Retrieve raw message content or metadata using a storage key.

Use this activity to:

- Monitor and export email delivery data in real time.
- Download stored message metadata or content for archiving.
- Analyze click-through rates or bounce statistics in workflows.

> **Use case**:  
> After sending bulk emails using another system, use this activity to fetch bounce, delivery, or open events. You can then process this data using `StaticLookup`, enrich it with contact info using `Join`, and upload filtered results to an external dashboard via `Google Sheets Upload`.

---

## Input

_Not Applicable_

---

## Output

| Output Type | Format | Description                                 |
| ----------- | ------ | ------------------------------------------- |
| **Files**   | CSV    | One or more CSV files for event records.    |
| **Data**    | JSON   | For message retrieval, response is in JSON. |

---

## Configuration Fields

| Field Name            | Description                                                                       | Required    |
| --------------------- | --------------------------------------------------------------------------------- | ----------- |
| **Connection**        | Mailgun connection (API Key and Domain).                                          | Yes         |
| **Entity**            | Type of resource to fetch: `Events` or `Messages`.                                | Yes         |
| **Number Of Retries** | Number of retry attempts on failure before giving up (default: 3).                | Optional    |
| **StorageKey**        | Mailgun storage key used to retrieve a specific message. Required for `Messages`. | Conditional |
| **Begin**             | Start of time range (in ISO format or epoch seconds) for events filter.           | Optional    |
| **End**               | End of time range (in ISO format or epoch seconds).                               | Optional    |
| **Ascending**         | Sort by time in ascending order (yes/no). Needed if `End` is not provided.        | Optional    |
| **Limit**             | Max number of entries to retrieve (default: 300).                                 | Optional    |
| **Event**             | Filter events by type (e.g., delivered, opened, failed).                          | Optional    |
| **List**              | Filter by mailing list address.                                                   | Optional    |
| **Attachment**        | Filter by file name attached to the email.                                        | Optional    |
| **From**              | Filter by sender address.                                                         | Optional    |
| **Message Id**        | Filter using Mailgun message ID.                                                  | Optional    |
| **Subject**           | Filter by email subject line.                                                     | Optional    |
| **To**                | Filter by recipient email in `To` header.                                         | Optional    |
| **Size**              | Filter emails based on size.                                                      | Optional    |
| **Recipient**         | Filter by actual email recipient.                                                 | Optional    |
| **Recipients**        | Filter by all recipients in case of stored events.                                | Optional    |
| **Tags**              | Filter by user-defined Mailgun tags.                                              | Optional    |
| **Severity**          | Filter by event severity (e.g., temporary, permanent).                            | Optional    |

---

## Sample Input

_Not applicable_

---

## Sample Configuration

| Field        | Value                  |
| ------------ | ---------------------- |
| `Connection` | `Mailgun_Prod_Conn`    |
| `Entity`     | `Events`               |
| `Begin`      | `2025-07-01T00:00:00Z` |
| `End`        | `2025-07-10T23:59:59Z` |
| `Limit`      | `100`                  |
| `Event`      | `delivered`            |
| `Ascending`  | `yes`                  |

---

## Sample Output

**For `Events` Entity (CSV file):**

| Id     | Event     | Timestamp            | Recipient        | Subject       | Size | Tags       |
| ------ | --------- | -------------------- | ---------------- | ------------- | ---- | ---------- |
| ev1234 | delivered | 2025-07-01T10:05:00Z | john@example.com | Welcome Email | 18KB | onboarding |
| ev1235 | opened    | 2025-07-01T10:08:00Z | jane@example.com | Promo Offer   | 22KB | promotions |

**For `Messages` Entity (JSON):**

```json
{
  "headers": {
    "message-id": "<abc@mailgun.org>",
    "subject": "Password Reset",
    "from": "support@example.com"
  },
  "recipients": ["user@example.com"],
  "attachments": ["reset_instructions.pdf"]
}
```
