Skip to main content

Mailgun

Send and track email through your Mailgun domains.

Connect it with: User name and password. Mailgun's own documentation: https://documentation.mailgun.com/docs/mailgun/api-reference/authentication.

What agents can do​

Connect Mailgun so the agents working your tasks can reach it. With it connected, they can:

  • Send an email through one of your Mailgun domains, plain or from a stored template.
  • Read delivery, open and bounce events for messages sent earlier.
  • Validate an email address before sending.
  • Manage mailing lists and suppressions.

Before you start​

  • A Mailgun account with at least one sending domain verified under Send > Sending > Domains.
  • Your account's region (US or EU), shown next to each domain.
  • A Jaah account. Anyone can add a personal secret; an organization secret needs an Org Owner or Admin.

Connect with Mailgun​

Jaah connects to Mailgun with a user name and password, not with a sign-in button.

Connect with an API key​

Find each value first:

  • Region: https://api.mailgun.net for a US-region account; https://api.eu.mailgun.net if your domains are in the EU region (Mailgun shows each domain's region under Send > Sending > Domains).
  • API user: Mailgun's API user name is always the word api - leave it as it is.
  • API key: Mailgun > your profile menu (top right) > API Security (Account Settings > API Keys) > Add new key, or the eye icon beside your Private API key. Copy the key.

Then add it to Jaah:

  1. In Jaah, open Secrets, select New, and pick the Mailgun card.
  2. Name the secret and choose who can use it.
  3. Fill in Region, API user, API key.
  4. Select Save. Jaah tests the secret straight away (see Test the connection).

Jaah encrypts what you type and never shows it again — not to you, and not to an admin.

Use your own OAuth app​

Not used: Jaah connects to Mailgun with a user name and password, not through an OAuth app.

Test the connection​

Select Test on the secret. Jaah calls Mailgun's API once (GET <Region>/v4/domains) with the stored values, and shows whether Mailgun accepted it, or which value Mailgun refused and the status it answered. Jaah also tests automatically when you save or reconnect.

The last result and its time stay on the secret's page, so you can see whether it still works without testing again.

Who can use it​

Every secret has an owner, and the owner decides who can use it:

  • Personal — only your own tasks can use it. This is the default.
  • Organization — every task in the organization can use it. Only Org Owners and Admins can choose this.
  • Attached to a project — every task on that project can use it, whoever started the task. See Attach a secret to a project.

More on owners and access: How secrets work.

Use it in an agent session​

An agent asks for the secret with its credential_get tool, by the secret's path, when it needs it, and gets the values for that one call. The path is the owner's prefix and the secret's name:

  • org/<name> for an organization secret,
  • projects/<project>/<name> for one attached to a project,
  • me/<name> for your personal one.

A key connection hands the agent its fields: base_url, api_user, api_key.

Tell the agent in your task description which secret to use, for example “use the Mailgun secret org/mailgun”.

Manage, rotate or disconnect​

Everything is on the secret's page under Secrets:

  • Rotate a key: create a new key at the vendor first, then select Replace on the secret and paste it. Revoke the old key at Mailgun once the test passes. Steps: Replace or delete a secret.
  • Disconnect: select Delete. The stored values are destroyed and agents lose access on their next call. To end access at Mailgun's side too, change the password at Mailgun or remove the user.

Limitations​

  • An account API key reaches every domain on the account. A domain's sending key can send for that domain only and cannot pass Test, which lists domains.
  • On Mailgun's free plan, mail goes only to authorized recipients added on the sandbox domain.
  • Agents can do only what the connected Mailgun account allows.

Troubleshooting​

Test says Mailgun rejected the API key (401)

Check the Region: an EU account's key is rejected at api.mailgun.net. If the region is right, create a new key under API Security and select Replace on the secret.

Test is rejected although sending works

You stored a domain sending key. Store an account API key instead (Account Settings > API Keys) so Jaah can list your domains.

Sending fails with Sandbox subdomains are for test purposes only

Add the recipient under the sandbox domain's Authorized Recipients, or send from a verified custom domain.

Still stuck? Select Test and read the result: it names the value Mailgun refused and the status it answered.

FAQ​

Why is there an API user field?

Mailgun's API uses HTTP Basic sign-in with the fixed user name api and your key as the password. Jaah keeps it as a field so agents receive the full pair.

Can Jaah or an admin see the key or token?

No. Jaah stores it encrypted and never shows it again. Only the tasks allowed to use the secret receive it, at the moment they ask for it.

Can I connect more than one Mailgun account?

Yes. Add one secret per account, each with its own name, and tell the agent which one to use.