Mailgun Setup logo

Mailgun Setup

OrganizationPopular
vellum-ai
mailgun-setup

Set up and send emails via a user-provided Mailgun account (BYO email provider)

Overview

Publishervellum-ai
Repositoryvellum-assistant
Skill namemailgun-setup
Stars
1.3K
Forks
186
Bundled files
4
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by vellum-ai on GitHub. Read the source before you install it.

Installation

Install the Mailgun Setup AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vellum-ai/vellum-assistant.git /tmp/vellum-assistant
mkdir -p .claude/skills
cp -r /tmp/vellum-assistant/skills/mailgun-setup .claude/skills/mailgun-setup
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Mailgun Setup in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Mailgun Setup on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Mailgun Setup is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Overview

Send emails through the user's own Mailgun account. The user provides their Mailgun API key and domain, and you send via their infrastructure.

Setup

Step 0: Check Existing Configuration

Before starting, check whether Mailgun is already configured:

bash
bun skills/mailgun-setup/scripts/check-config.ts

The script outputs JSON: { "configured": boolean, "hasApiKey": boolean, "hasWebhookKey": boolean, "details": string }.

  • If configured is true — Mailgun is already set up. Offer to verify the connection or reconfigure.
  • If configured is false — continue to Step 1.

Step 1: Store the API Key

Run the store script to securely collect the API key:

bash
bun skills/mailgun-setup/scripts/store-api-key.ts

The script opens a secure credential prompt, stores the key, and exits. If it exits 0, the key is stored. Exit code 130 means the user cancelled the prompt — nothing was stored; that's a valid choice, not an error, so ask whether they'd like to try again rather than treating it as a failure. Any other non-zero exit is a real failure. Never ask for the key in chat.

Note: Mailgun uses HTTP Basic Auth with username api and the API key as the password. The credential proxy cannot construct Basic Auth headers automatically. Instead, use curl -u "api:$KEY" in bash commands — retrieve the key from the vault at runtime. See the sending examples below.

Step 2: Detect the Domain

After storing the API key, automatically detect the user's domain — don't ask them for it. Retrieve the API key from the vault and call the Mailgun Domains API:

bash
curl -s --user "api:$MAILGUN_API_KEY" \
  https://api.mailgun.net/v4/domains?state=active

The response contains an items array of domain objects with name and state fields. Pick the first domain with "state": "active". If no active domains are found, try the EU endpoint (https://api.eu.mailgun.net/v4/domains?state=active). If still none, tell the user they need to verify a domain in their Mailgun dashboard first.

Use hi@<domain> as the default sender address. Remember the domain and region (US/EU) for future sends.

Step 3: Verify the Connection

Confirm the API key works by checking the domain response returned in Step 2. A successful response (HTTP 200) with domain data confirms the connection.

Step 4: Webhook Setup (for receiving email)

If the user also wants to receive emails via Mailgun, run the webhook setup script:

bash
bun skills/mailgun-setup/scripts/setup-webhook.ts --domain "<verified domain>" [--region eu]

This script:

  1. Registers a callback URL via the webhooks system
  2. Creates an inbound route in Mailgun via their API
  3. Prompts the user for their webhook signing key (found in the Mailgun dashboard: Settings > API Security > HTTP Webhook Signing Key)

If the script fails because no public base URL is configured (self-hosted only), load the public-ingress skill to walk the user through setting one up, then retry.

Step 5: Report Success

Summarize with the completed checklist:

"Setup complete! ✅ API key configured ✅ Domain detected: <domain> (region: US/EU) ✅ Connection verified {webhook_line}

Default sender: hi@<domain>"

For {webhook_line}:

  • If webhook was set up: ✅ Inbound route and webhook signing key configured
  • If skipped: ⬜ Webhook — run setup again to enable inbound email

Sending Email

Use bash with curl to call the Mailgun API. Pass the API key via -u for Basic Auth:

bash
curl -s --user "api:$MAILGUN_API_KEY" \
  https://api.mailgun.net/v3/DOMAIN/messages \
  -F from="Name <sender@example.com>" \
  -F to="recipient@example.com" \
  -F subject="Hello" \
  -F text="Plain text body" \
  -F html="<p>HTML body</p>"

Replace DOMAIN with the user's Mailgun sending domain.

API Parameters

ParameterTypeRequiredDescription
fromstringSender address ("Name <email>" format)
tostringRecipient(s), comma-separated for multiple
subjectstringEmail subject
textstringPlain text body
htmlstringHTML body
ccstringCC recipients, comma-separated
bccstringBCC recipients, comma-separated
h:Reply-TostringReply-to address
h:In-Reply-TostringMessage-ID of parent (for threading)
h:ReferencesstringSpace-separated chain of ancestor Message-IDs

Threading (replies)

To reply in a thread, include custom headers:

bash
curl -s --user "api:$MAILGUN_API_KEY" \
  https://api.mailgun.net/v3/DOMAIN/messages \
  -F from="bot@example.com" \
  -F to="user@example.com" \
  -F subject="Re: Original subject" \
  -F text="Reply body" \
  -F "h:In-Reply-To=<original-message-id>" \
  -F "h:References=<original-message-id>"

Response

Success returns { "id": "<message-id>", "message": "Queued. Thank you." } with HTTP 200.

Errors return { "message": "error description" } with 4xx/5xx status.

Regions

Mailgun has US and EU regions:

  • US (default): https://api.mailgun.net/v3/DOMAIN/messages
  • EU: https://api.eu.mailgun.net/v3/DOMAIN/messages

Ask the user which region their account uses if sends fail with 401.

Important Notes

  • The from address must be from the user's verified Mailgun domain.
  • Default sender address is hi@<domain> — use this unless the user specifies otherwise.
  • Always confirm with the user before sending — never send without explicit permission.
  • Use text for plain text, html for rich formatting. Provide both when possible.
  • Mailgun's free tier allows 100 emails/day. Paid plans have higher limits.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Mailgun Setup AI skill do?

Set up and send emails via a user-provided Mailgun account (BYO email provider)

Why use Mailgun Setup on TypingMind?

Because you install it once and use it with any model. Mailgun Setup is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Mailgun Setup in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/vellum-ai/vellum-assistant/tree/main/skills/mailgun-setup. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Mailgun Setup?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Mailgun Setup?

As many as you like. As long as a model supports skills, you can use Mailgun Setup with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Mailgun Setup AI skill free?

Yes. It is published on GitHub by vellum-ai under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇