Skip to content
Mailgun logo

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

  1. Find the contact in Salesforce by email
  2. 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

  1. Send a message with the welcome content
  2. Add a list member to the customers mailing list

With Stripe

Alert the team in Slack on Mailgun spam complaints

When

Spam complaint received

Then

  1. Post the recipient and domain to the deliverability channel in Slack
  2. Mark the contact unsubscribed in HubSpot

With Slack and HubSpot

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

documentation.mailgun.com/docs/mailgun/api-reference/api-…

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.

Great — a couple more details

This helps us connect you with the right person. Optional, and you can skip it.