
Connectors / Communication · HTTP Connector
Automate Mailgun with Tray.ai
Send a message, create a domain and create a mailing list in Mailgun, and start a workflow when Mailgun sends “Message accepted”.
What can you do with Mailgun on Tray.ai?
Mailgun is an email delivery service for developers, used to send, receive, and track transactional and bulk email through an API. Tray.ai connects to Mailgun through the HTTP Connector, so your workflows can call the Mailgun API alongside the rest of your stack.
- When Mailgun sends “Delivery failed permanently”, mark the email as invalid in your customer database.
- When Mailgun sends “Spam complaint received”, unsubscribe the person in your CRM.
- Send a message when your billing system issues an invoice.
- Add a list member when a customer opts in on your website.
- Connects through
- HTTP Connector
- Authentication
- Basic authentication
- Base URL
- https://api.mailgun.net
Set it up
Connect Mailgun to Tray.ai
Each step uses Mailgun's own API details, from its documentation.
Step 1
Save Mailgun's username and password
Save the credentials Mailgun gives you as a Tray.ai authentication. The HTTP Client sends them as basic auth. They stay out of the workflow and out of the logs.
Step 2
Point the HTTP Client at the API
Add an HTTP Client step and use https://api.mailgun.net as the base URL. Or paste a cURL example from Mailgun's API docs, and Tray.ai fills in the method, URL, and headers.
Step 3
Start with “List domains”
It's one of 10 documented actions, under Domains. The response comes back as data the next step can map into your other apps.
Step 4
Start workflows from Mailgun events
Give Mailgun the URL of a Tray.ai webhook trigger. “Message accepted” can then start a workflow, and so can 7 other events.
Workflows to build with Mailgun
Each one uses actions and events from Mailgun's own API documentation.
Flag Mailgun permanent failures in Salesforce
When
Delivery failed permanently
Then
- Find the contact in Salesforce by email
- Mark the email as bounced on the contact in Salesforce
With Salesforce
Send Mailgun welcome emails to new Stripe customers
When
A customer is created in Stripe
Then
- Send a message with the welcome content
- Add a list member to the customers mailing list
With Stripe
Apps you can build on Mailgun data
Internal tools your team can build with an AI assistant, each one using Mailgun calls from its API documentation.
Delivery failure feed
Lists delivery failures, unsubscribes and spam complaints as they happen so support can follow up.
Sending domain admin
Lists sending domains and lets an admin verify or update a domain.
Give your AI agents Mailgun tools
Build an MCP server on Mailgun in Agent Gateway and choose which actions your agents can call. Every call runs with access control and an audit trail. How Agent Gateway works
- Send a message
- List domains
- Create a mailing list
- Send a MIME message
- Create a domain
- Update a domain
- Verify a domain
- Delete a domain
What the Mailgun API covers
3 resources and 10 documented actions, each one a call the HTTP Connector can make from a Tray.ai workflow. Connecting it takes a few clicks: here's how.
Messages
- Send a message
- Send a MIME message
Domains
- List domains
- Create a domain
- Update a domain
- Verify a domain
- Delete a domain
Mailing lists
- Create a mailing list
- Add a list member
- Bulk add list members
Events Mailgun can send to a Tray.ai webhook trigger
- Message accepted
- Message delivered
- Delivery failed permanently
- Delivery failed temporarily
- Email opened
- Link clicked
- Recipient unsubscribed
- Spam complaint received
Checked against Mailgun's own documentation on 2026-10-22
How Tray.ai makes this work
Mailgun plugs into the whole Tray.ai platform
Intelligent Integration
Integrate and automate across 12,000+ apps, databases, APIs, and services with visual workflows, error handling, and observability.
Learn more →Agent Builder
Build AI agents that read, write, and take action in Mailgun — with guardrails, audit, and human-in-the-loop.
Learn more →Agent Gateway for MCP
Expose Mailgun actions as governed MCP tools — observable, rate-limited, authenticated.
Learn more →Tray Helix
Build apps on Mailgun data with your AI assistant, then deploy, run, and govern them on Tray.ai.
Learn more →More communication apps on Tray.ai
Dedicated connectors and other apps Tray.ai reaches in the same category. See every communication connector →
Frequently asked questions
What can a Tray.ai workflow do in Mailgun?
+
The Mailgun API documents 10 actions across 3 resources (Messages, Domains, Mailing lists). For example: Send a message; List domains; Create a mailing list. A workflow can make any documented call through the HTTP Connector.
How does Tray.ai authenticate with Mailgun?
+
The Mailgun API uses basic authentication. You save it once as a Tray.ai authentication, and the HTTP Connector adds it to every request.
Which Mailgun events can start a Tray.ai workflow?
+
Mailgun sends 8 events to a webhook URL, for example: Message accepted; Message delivered; Delivery failed permanently; Delivery failed temporarily; Email opened; Link clicked; Recipient unsubscribed; Spam complaint received. A Tray.ai webhook trigger receives them and starts a workflow.
See Mailgun working against your stack.
We'll walk through a tailored demo with your systems plugged in.
Thanks — someone from our team will be in touch soon.