Mailgun Inspect for Salesforce is a native Salesforce package that adds email preview, QA, and code analysis capabilities to the AgentForce Marketing (Marketing Cloud Next) email preview experience (which uses the Lightning Email Template / Email Content Builder). Once connected, you can preview how your email templates render across 100+ email clients and devices - including dark mode variants - run accessibility and code analysis checks, and build your own device testing profiles, all without leaving Salesforce.
This guide covers installing the package, connecting your Mailgun account, and running your first preview.
Before you begin
Before setting up the integration, confirm the following:
Salesforce requirements
- Salesforce edition: Enterprise or Unlimited Edition (Lightning Experience)
- Supported Salesforce products: AgentForce Marketing (Marketing Cloud Next) email experiences that use the Lightning Email Template / Email Content Builder (for example, emails created in CMS Workspaces and previewed in the AgentForce Marketing Content app)
- Admin access: A Salesforce system administrator must install the Mailgun Inspect managed package and assign the Mailgun Admin/User permission sets
Although the Lightning Email Template Builder is used in Sales Cloud, Service Cloud, and Account Engagement (Pardot), Mailgun Inspect does not currently integrate with those surfaces. It also does not support Marketing Cloud Engagement (Email Studio / ExactTarget), which uses Content Builder.
If you're unsure which platform you're on, confirm that you have AgentForce Marketing (Marketing Cloud Next) enabled and that you're creating emails from the AgentForce Marketing apps before proceeding.
Mailgun requirements
- A Mailgun account with access to Mailgun Inspect (you can set one up from within Salesforce as part of the configuration process)
- If you're already a Mailgun Inspect customer, have your API key ready
Step 1: Install the package from AppExchange
A Salesforce system administrator must complete this step. You don't need a Mailgun account or API key to install the package - that comes later, when you connect the integration.
We recommend installing and validating the package in a Salesforce sandbox or developer org before deploying to production.
- Log in to Salesforce as a system administrator.
- Open the Mailgun Inspect listing on AppExchange and click Get It Now.
- Choose the target org (sandbox or production) when prompted.
- On the installation options screen, select Install for Admins Only, this lets you complete configuration and testing before enabling access for your marketing team.
- Complete the installation and wait for the confirmation email from Salesforce.
If installation fails with an error that includes uiPreviewMessageTabDef, see Troubleshooting below.
Step 2: Assign permissions
After installation, assign the Mailgun permission sets to the appropriate users in your org.
- In Salesforce, go to Setup → Permission Sets.
- Locate the two permission sets installed with the package: Mailgun Admin and Mailgun User.
- Assign permissions based on each user's role:
- Salesforce administrator: assign Mailgun Admin. This gives access to the Mailgun Configuration tab to enter and manage the API key.
- Marketing operations: assign Mailgun Admin or Mailgun User, depending on whether they need configuration access or only preview access.
- Marketer / content creator: assign Mailgun User. This allows them to run Inspect on templates and review results.
Self-serve plan limits: On self-serve Basic and Premium plans, you can enable the integration for a maximum of 5 Salesforce users (assigned either the Mailgun Admin or Mailgun User permission set). This limit applies only to Salesforce user access - you can still have unlimited users on your Mailgun account itself. To increase the number of Salesforce users, contact our sales team.
Step 3: Connect your Mailgun account
Once permissions are assigned, an admin connects the org to Mailgun. Open the Mailgun app in Salesforce - the Welcome tab shows a banner prompting you to finish setup.
- In Salesforce, open the Mailgun app and click Connect Mailgun on the Welcome tab (or go directly to the Configuration tab).
- On the Get started with Mailgun Inspect screen, choose how you'd like to connect:
- Sign up for Mailgun Inspect — if you don't have a Mailgun account yet. Click Sign up to open the Mailgun Inspect pricing page in a new tab.
- Sign in to my account — if you're already a Mailgun Inspect customer. Click Paste API key to go straight to the connection screen with your key.
New customers: sign up for Mailgun Inspect
- Clicking Sign up opens the Mailgun Inspect pricing page.
- Choose a plan and complete sign-up - no sales call required for the Basic or Premium plans. If you're interested in custom/contract pricing, you can click Contact us to talk to Sales.
- Once your account is created, copy your API key (see Getting your API key below) and return to the Configuration tab in Salesforce to finish connecting.
Existing customers: sign in with your API key
If you already have a Mailgun Inspect account, click Paste API key to go to the connection screen.
Getting your API key
- Log in to your Mailgun account at app.mailgun.com.
- Confirm your plan includes Inspect under Plan & Billing. If it doesn't, upgrade or purchase Inspect before continuing.
- Navigate to Account Settings → API Security.
- Click Create Key, give it a descriptive name (for example, Salesforce Integration), and copy it immediately — the key is only shown once at creation.
Your Mailgun API key grants broad API access to your account. Never share it publicly or store it in unsecured locations. Restrict access to the Mailgun Configuration page to administrators only.
Finish connecting
With your API key in hand, you're ready to connect Mailgun Inspect to your Salesforce org.
- In Salesforce, open the Mailgun app and navigate to the Mailgun Configuration tab.
- Paste your API key into the Mailgun API key field.
- Click Verify Key.
- Wait for the integration to connect and confirm the number of email clients loaded. A Connection ready status indicates the integration is working.
If your key is valid but Inspect isn't available on your plan, you'll see a banner prompting you to purchase Inspect. Click Purchase Inspect to upgrade, then refresh the page - no need to re-enter your key.
If the connection fails, check the following:
- Confirm the API key is active and was copied correctly from the right Mailgun region (US or EU).
- Go to Setup → Remote Site Settings in Salesforce and confirm that Mailgun_US_API or Mailgun_EU_API (depending on your region) is enabled.
- If your org has outbound network restrictions, confirm that the Mailgun API endpoint is not being blocked.
Step 4: Preview, QA, and analyze an email template
Once a Salesforce admin has verified the API key and assigned the appropriate Mailgun permission sets, end users do not need to do any additional configuration - the Mailgun Inspect tab will appear automatically inside the email template preview dialog.
- In Salesforce, navigate to the AgentForce Marketing app and open the email you want to preview.
- Open an existing email template or create a new one.
- Click the Preview button on the template, then select the Mailgun Inspect tab in the preview dialog.
- Your previews will generate automatically, showing how the template renders across supported email clients and devices, including dark mode variants.
- Use the Previews, QA, and Code analysis tabs at the top to review results directly in Salesforce:
- Click Open full report in Mailgun Inspect at any time to view the complete results in the Mailgun Inspect app.
- After making edits to your template, return to the preview and click Retest to regenerate previews, QA, and code analysis with your latest changes.
Step 5: Create and manage device profiles
By default, Mailgun Inspect tests templates against every email client and device on your account. If you only need to test a specific subset — for example, your top-priority clients — you can create a custom device profile and reuse it across templates.
- From the Mailgun Inspect tab in the preview dialog, click Manage profiles.
- Click Create New Profile.
- Enter a Profile Name.
- Optionally check Set as default profile to use this profile automatically on future previews.
- Under Select Email Clients, check the individual clients and devices you want to include (grouped by Mobile, Desktop, and Web).
- Click Create Profile.
Your new profile appears in Manage Profiles, along with a count of mobile, desktop, and web clients included and the total.
Device profiles created in Salesforce are specific to this integration and are separate from any profiles you may have created directly in Mailgun Inspect.
Troubleshooting
Installation fails with uiPreviewMessageTabDef error
This error indicates that Marketing Cloud Next is not fully enabled in your org. Enable Marketing Cloud Next in your Salesforce org settings and retry the installation.
API key verification fails
- Confirm the key is active and associated with the correct Mailgun region (US or EU).
- Check that the appropriate Remote Site setting (Mailgun_US_API or Mailgun_EU_API) is enabled under Setup → Remote Site Settings.
- Check whether your org has firewall or proxy rules that may block outbound connections to Mailgun's API endpoints.
Users can't see the Mailgun Inspect tab
- Confirm the user has either the Mailgun Admin or Mailgun User permission set assigned.
- Confirm that the API key has been successfully verified in the Mailgun Configuration tab - the tab will only appear once the connection is established.
Preview templates appear blank or don't load
- Confirm the template contains email content and has been saved before running Inspect.
- Check that the API key is still active and hasn't been revoked or rotated.
Frequently asked questions
Do I need Salesforce AgentForce Marketing specifically?
Yes - Mailgun Inspect currently integrates only with AgentForce Marketing (Marketing Cloud Next) email experiences. Although the same Lightning Email Template Builder framework is also used in Sales Cloud, Service Cloud, and Account Engagement (Pardot), Mailgun Inspect does not currently surface in those products.
What Salesforce edition do I need?
Mailgun Inspect for Salesforce supports Enterprise and Unlimited Editions. Other editions can install managed packages from AppExchange in general, but are not supported for this integration.
Can I install the package in a sandbox before going to production?
Yes, and we recommend it. Install and validate in a sandbox first, then deploy to production once you've confirmed everything is working.
Does Mailgun Inspect change my email templates?
No. Mailgun Inspect reads your template content to generate previews and run QA/code analysis but does not modify your templates, sending configuration, or any Salesforce data.
What data is sent to Mailgun when I run a preview?
The rendered HTML of your email template is sent to Mailgun to generate previews and QA/code analysis results. No Salesforce credentials, user data, or CRM records are transmitted. The integration authenticates using only your Mailgun API key.
What do the QA and Code analysis tabs check for?
QA surfaces accessibility and content quality issues in your template, including WCAG-related checks such as color contrast. Code analysis flags HTML/CSS attributes that aren't supported by specific email clients, so you can see exactly which clients and applications are affected before you send.
Can I test against only some of my devices?
Yes. Use Manage profiles in the Mailgun Inspect tab to create a custom device profile with just the clients and devices you care about, and set it as your default. See Step 5 above.
Is there a limit on how many Salesforce users can use the integration?
On self-serve Basic and Premium plans, a maximum of 5 Salesforce users can be enabled for the integration. This only limits Salesforce user access - your Mailgun account itself can still have unlimited users. If you need more than 5 Salesforce users, reach out to our sales team to increase your limit.
Who handles support - Mailgun or Salesforce?
For questions about the Mailgun Inspect package, account setup, preview results, or billing, contact Mailgun Support. For questions about Salesforce platform behavior (installation errors unrelated to the package, AppExchange account issues, Lightning Email Template access), contact Salesforce Support.
How many email clients and devices are supported?
Mailgun Inspect supports 100+ email clients and devices in the current version, including desktop, mobile, and dark mode variants.
How do I know when I'm running low on previews?
Usage tracking within Salesforce is planned for a future release. In the meantime, you can monitor your preview consumption in the Mailgun dashboard. If you expect high preview volume, you can review plan and overage details on the Mailgun Inspect pricing page.