AFI AFI

Mailgun Transactional

Estimated reading: 2 minutes Updated August 1, 2026

This integration sends a one-off transactional email via Mailgun when a form is submitted, useful for confirmation emails, receipts, lead-magnet delivery, or internal alerts. It’s separate from the standard Mailgun integration which handles mailing-list membership.

What you’ll need

  • An active Mailgun account with at least one verified sending domain.
  • Your Mailgun Private API key (Account Settings → API Keys).
  • Your Mailgun region (US or EU).
  • The Advanced Form Integration plugin installed and activated.

Connect Mailgun Transactional to AFI

  1. In WordPress, go to AFI → Settings → Mailgun Transactional.
  2. Enter the API key and pick the region.
  3. Click Save Changes.

Create the integration

  1. Go to AFI → Add New.
  2. Configure the trigger.
  3. In Action → Platform, select Mailgun Transactional.
  4. In Task, choose Send Email or Send Template.
  5. Pick the Domain (Mailgun verified sending domain).
  6. Map the fields:
  • From: sender address (must be on the verified domain).
  • To: recipient (typically map to the form’s email field).
  • Subject.
  • Text Body and/or HTML Body for raw send.
  • For templated send: Template Name plus Template Variables (mapped per template variable).
  • Cc, Bcc, Reply To.
  • Tags for filtering in Mailgun’s analytics.
  1. Optional: configure Conditional Logic.
  2. Click Save Integration.

Screenshot: AFI field-mapping screen with Mailgun Transactional email fields visible

Tasks supported

Send Email

Sends a one-off email built from form data. Use this when you don’t need a saved template.

Send Template

Renders a saved Mailgun template with variables pulled from the form. Recommended for any email you send more than once.

Conditional logic example

Send a “thank you for upgrading” template only when the form’s plan field equals “premium”. Free signups get a different template through a separate integration.

Troubleshooting

“Forbidden”

Mailgun rejects sends from unverified domains. Verify the From domain in Mailgun under Sending → Domains.

Email accepted but never received

Mailgun’s “accepted” status only confirms the API call succeeded. Check the Logs tab in Mailgun for the actual delivery status. Bounces, spam complaints, and DNS-related rejections are tracked there.

Related docs