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

# Connect Mailgun to P2HS

> Use the Mailgun connector with P2HS applications and capabilities.

## Overview

Transactional email delivery, scheduled delivery, recipient-variable batch sending, stored message retrieval, resend, and domain queue controls.

**Category:** Email\
**Catalog status:** available

## Supported capabilities and connector actions

| Connector action | Description |
| - | - |
| `mailgun.send_email` | Send email. Send a Mailgun message immediately or schedule it with scheduled\_at. |
| `mailgun.send_batch_email` | Send batch email. Send one Mailgun message to up to 1,000 recipients using recipient-variables for per-recipient personalization. |
| `mailgun.retrieve_email` | Retrieve stored email. Retrieve a stored Mailgun email by storage\_key from Mailgun events. |
| `mailgun.resend_email` | Resend stored email. Resend a stored Mailgun email by storage\_key. |
| `mailgun.get_sending_queue` | Get sending queue. Retrieve default and scheduled queue status for a Mailgun domain. |
| `mailgun.cancel_domain_queue` | Cancel domain queue. Delete all scheduled and undelivered mail from a Mailgun domain queue. Mailgun cancellation is domain queue-level, not individual email-level. |

## Direction

* **P2HS → Mailgun:** Yes — supported actions can send data or requests to the provider.
* **Mailgun → P2HS:** Yes — the catalog declares inbound triggers.
* **Webhooks:** Event delivery is represented by the declared triggers.

## Prerequisites

* A Mailgun account with permission to create or authorize the connection.
* The credentials or authorization flow required by P2HS (Api key).
* Any provider-side account, workspace, repository, store, or sending-domain permissions required for the selected capability.

## Connect the integration

1. Open the P2HS dashboard.
2. Select the project or workspace where the connector will be used.
3. Open Integrations and choose **Mailgun**.
4. Select Connect and complete the provider authorization or credential form.
5. Save the connection and run the verification check.
6. Bind the connection to a compatible capability, App Block, or Feature Pack.

## Credentials and configuration

**Authentication:** Api key.

The current catalog requires these credential fields:

* `api_key`

Configurable fields exposed by the connector:

* `domain`
* `region`
* `from_email`
* `from_name`

P2HS stores connector credentials as managed secrets. Rotate or revoke them from the connection settings; do not commit them to source code or expose them in browser code.

## Generated applications

After **Mailgun** is connected, compatible capabilities and composed application features can bind to the connection. The generated application should call the approved P2HS capability rather than embedding Mailgun credentials.

```text theme={null}
Generated application
        ↓
P2HS capability
        ↓
Mailgun connector
        ↓
External provider
```

## Events and webhooks

The catalog declares these inbound events:

* `email_accepted` — Email accepted
* `email_delivered` — Email delivered
* `email_failed` — Email failed
* `email_opened` — Email opened
* `email_clicked` — Email clicked
* `email_complained` — Email complained
* `email_unsubscribed` — Email unsubscribed

Inbound events are verified and processed by the P2HS integration contract before application state is updated.

## Troubleshooting

* **Authentication failed:** confirm the credential or authorization flow and the provider account selected.
* **Permission denied:** verify that the provider account can access the configured resource and action.
* **Action unavailable:** confirm that the capability is admitted for the project and supported by this connector.
* **Event not received:** check the connection status, provider event configuration, and the project environment.

## Disconnect or rotate credentials

Update or revoke the connection from the project or workspace Integrations settings. Dependent capabilities may stop working after disconnecting; reconnect and verify the binding before retrying the application flow.

## Related concepts

* [Integration troubleshooting](/content/support/troubleshooting/integrations)
* [Connector model](/content/integrations/connectors)
* [App features](/content/backend/overview)
* [Capabilities reference](/content/composition/capabilities)


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