> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendpost.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting & FAQs

> Common issues, solutions, and frequently asked questions for Mailgun integration with SendPost.

## Common Issues

<AccordionGroup>
  <Accordion title="Emails Not Sending" icon="envelope">
    **Symptoms**: Emails are not being delivered through Mailgun

    **Checklist**:

    * Verify your Mailgun API key is valid and has full access permissions
    * Check that the Mailgun domain is correct and verified in your Mailgun account
    * Ensure the TPSP is active in SendPost
    * Review the SendPost event logs for errors
    * Confirm your Mailgun account is in good standing

    **Test Your API Key**:

    ```bash theme={null}
    curl -s --user 'api:YOUR_MAILGUN_API_KEY' \
      https://api.mailgun.net/v3/domains
    ```

    If this returns 401, your API key is invalid.
  </Accordion>

  <Accordion title="Events Not Appearing" icon="bell-slash">
    **Symptoms**: Emails are sent but opens/clicks/bounces not showing

    **Checklist**:

    * Verify webhooks are registered in Mailgun Dashboard
    * Check webhook URLs are correct for each event type
    * Ensure webhook events are enabled
    * Wait a few minutes (events are batched for processing)

    **Verify Webhooks in Mailgun**:

    1. Go to Mailgun → Sending → Webhooks
    2. Confirm webhooks are configured for each event type
    3. Verify URLs show: `https://api.sendpost.io/tpsp/mailgun/account/{account-id}`
  </Accordion>

  <Accordion title="Bounces Not Processing" icon="rotate-left">
    **Symptoms**: Bounced emails not reflected in analytics

    **Check**:

    * Review SMTP codes in event details
    * Hard bounces (permanent severity) = permanent failures
    * Soft bounces (temporary severity) = temporary failures
    * Ensure bounce events (failed) are enabled in webhook settings
  </Accordion>

  <Accordion title="API Key Errors" icon="key">
    | Error Code | Meaning             | Solution                                          |
    | ---------- | ------------------- | ------------------------------------------------- |
    | 401        | Unauthorized        | Regenerate API key in Mailgun                     |
    | 403        | Forbidden           | Check API key permissions                         |
    | 429        | Rate limit exceeded | Wait and retry, or increase limits                |
    | 400        | Bad Request         | Check payload format, domain, or recipient format |
    | 404        | Not Found           | Verify domain is correct                          |
  </Accordion>

  <Accordion title="Webhook Registration Issues" icon="globe">
    **Symptoms**: Some or all webhooks not registered

    **Checklist**:

    * Check if webhooks appear in Mailgun dashboard
    * Verify API key has webhook permissions
    * Ensure SendPost API is accessible from Mailgun servers
    * Try recreating the TPSP in SendPost

    **Note**: Mailgun requires a separate webhook for each event type. Some event types may fail to register independently.
  </Accordion>
</AccordionGroup>

***

## Getting Help

If you're still experiencing issues:

1. **Check Logs**: Review detailed event logs in SendPost dashboard
2. **Contact Support**: Reach out to SendPost support with:
   * Your account ID
   * TPSP ID
   * Message ID (if available)
   * Error messages
   * Timestamp of the issue

***

## FAQs

<AccordionGroup>
  <Accordion title="Can I use multiple Mailgun accounts?">
    Yes! Create a separate TPSP for each Mailgun account. Each will have its own webhooks and configuration.
  </Accordion>

  <Accordion title="Does SendPost store my Mailgun API key securely?">
    Yes, all API keys are encrypted at rest and never exposed in logs or API responses.
  </Accordion>

  <Accordion title="Can I use Mailgun for some emails and SendPost IPs for others?">
    Yes, SendPost supports intelligent routing. You can configure IP Pools to route specific traffic through Mailgun and the rest through SendPost's native infrastructure.
  </Accordion>

  <Accordion title="What happens if the webhook endpoint is temporarily unavailable?">
    Mailgun will retry webhook delivery. Events will be processed once connectivity is restored.
  </Accordion>

  <Accordion title="How do I use Mailgun's EU region?">
    If your Mailgun account is in the EU region, you may need to configure the EU API endpoint. Contact SendPost support for assistance with EU region configuration.
  </Accordion>

  <Accordion title="Can I specify which Mailgun IP Pool to use?">
    Yes! Use the `tpspIppool` parameter in your API request to specify a Mailgun IP Pool, or use `tpspIp` to specify a specific IP address owned by your account.
  </Accordion>

  <Accordion title="Can I gradually migrate traffic?">
    Yes! You can run both systems in parallel during migration. Configure your SendPost IP Pool to route a percentage of traffic to Mailgun while keeping some on your current system.
  </Accordion>

  <Accordion title="What's the latency for event processing?">
    Events are typically processed within 1-5 seconds of being received from Mailgun.
  </Accordion>

  <Accordion title="Is there a limit on emails per day?">
    SendPost doesn't impose hard limits, but your Mailgun plan limits still apply. Configure throttling to match your Mailgun limits.
  </Accordion>

  <Accordion title="How is Mailgun different from SendGrid/SparkPost integration?">
    The main difference is that Mailgun requires a separate webhook registration for each event type, while SendGrid and SparkPost use a single webhook for all events. SendPost handles this automatically during setup.
  </Accordion>
</AccordionGroup>
