Th Mailgun Inspect extension for Visual Studio Code lets you preview your HTML emails across 100+ email clients and run content analysis without leaving VS Code. You write your email HTML, click one button, and get rendering previews plus link validation, image validation, accessibility testing, code compatibility analysis, and spam testing results side by side with your code.
This guide walks you through installing the extension, connecting it to your Mailgun account, and generating your first preview.
Before you begin
You'll need all of the following:
| Requirement | Notes |
| A Mailgun account with Inspect access |
If your account doesn't have it, you can add it from Plan & Billing in the Mailgun control panel. If you don’t have an account, you can get a 30 day free trial here. |
| Mailgun API Key | You'll create one in Step 2 of this guide. This must be an account-level API key, not a domain sending key, and needs to have admin permissions. |
| Visual Studio Code Desktop 1.85 or newer |
This is only available on the desktop version of VS Code, on version 1.85 or newer. You cannot use this via the VS Code web app. Check your VS Code version under Code → About Visual Studio Code (macOS) or Help → About (Windows/Linux). |
Which features your plan includes
Previews work on every Inspect plan. The content checks are plan-dependent:
| Feature | Basic | Premium | Contract |
| Email previews across 100+ clients and devices | Yes | Yes | Yes |
| Link validation | No | Yes | Yes |
| Image validation | No | Yes | Yes |
| Accessibility testing | No | Yes | Yes |
| HTML Code Analysis | No | Yes | Yes |
| Spam Testing | No | Yes | Yes |
If a check isn't included in your plan, the extension still runs and shows you previews — the corresponding tab will simply tell you the feature isn't enabled on your account. To add a check, upgrade from Plan & Billing in the Mailgun control panel.
Step 1: Install the extension
From inside VS Code desktop:
- Open the Extensions view with Cmd+Shift+X (macOS) or Ctrl+Shift+X (Windows/Linux).
- Search for Mailgun Inspect.
- Find the result published by Sinch and click Install.
Step 2: Get your Mailgun API key
The extension authenticates to the Mailgun Inspect API with your own API key. If you already have an account-level key saved somewhere safe, skip to Step 3.
- Log into your Mailgun Account.
- Click your Profile Menu in the top-right corner, then select API Security.
- Click Add new key.
- Enter a description you'll recognize later — for example, “VS Code — Inspect extension”.
- Set the role to Admin, then click Create key.
Copy the key immediately. Mailgun displays the key secret only once, at creation. If you lose it, you can't retrieve it — you'll have to create a new one. Store it in your password manager.
Two things to watch for:
- Use an account API key, not a domain sending key. Domain sending keys are restricted to sending messages and won't authenticate against the Inspect API.
- The key needs the Admin role.
Step 3: Connect the extension to your account
Save your API key
- Open the command palette with Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux) – or just click the search bar at the top and type >.
- Type and run Mailgun Inspect: Set API Key.
- Paste your key and press Enter.
Your key is stored securely by the extension rather than in your settings file, so it won't show up in settings.json.
Set your region
Mailgun operates separate US and EU infrastructure, and your API key only works in the region where your account lives.
- Run Mailgun Inspect: Open Settings from the command palette, or click the gear icon on the Mailgun Inspect listing.
- Set Mailgun Inspect: Region to the region your Mailgun account is in — US or EU.
The default is US, so change it if your account is in the EU region.
Set default clients
While you are in settings, you can also select which clients you want to run by default. To do this you need to enter in the client IDs. If you leave this blank, it will default to all clients, though you can customize which ones get includes as you run the test. You can access the client list using this API call.
How client selection affects your usage
This is worth understanding before you select 100 clients:
One preview = one rendering. If you run a test against 100 clients/devices, that consumes 100 previews from your monthly allotment — not one. A Basic plan includes 1,000 previews per month, and Premium includes 2,000. Beyond your allotment, you are charged an overage rate.
If you are concerned about usage, you can test your email on less clients and devices.
Step 4: Generate your first preview
- Open an HTML email file in VS Code. The file needs to be recognized as HTML — check the language mode in the bottom-right status bar if you're unsure.
- Click the eye icon in the editor title bar or run Mailgun Inspect: Generate Preview from the command palette.
Select your previews
Once you run this, the command bar will open up with a drop down of the clients and devices. Unless you selected specific clients as default, all of them will be selected by default. Select the previews you want included and then run it.
The extension sends the HTML of the active editor to the Mailgun Inspect API and then polls for results. Renderings arrive progressively — real email client screenshots take time to produce, so expect to wait rather than seeing everything at once.
Reading your results
Results open in a panel alongside your code, organized into two areas.
Previews is the top section. It shows client-by-client renderings of your email.
Content Analysis (for Premium and Contract only) is the lower section and is split into five tabs:
- Links — broken links, missing URL schemes, and redirect issues.
- Image Validation — missing images and oversized assets.
- Accessibility — WCAG-relevant issues, each with the offending HTML snippet and selector.
- Code Analysis — HTML and CSS support reporting across email clients.
- Spam Testing — quick deliverability check on your content against popular spam filter providers. Unlike the other checks, this does run on its own — you have to activate it. If you want spam test results, open the Spam Testing section, type in a subject line and a from name, and click Run Spam Test. It's easy to assume spam results simply aren't included in your plan when in fact they're just waiting to be triggered.
For link, image, accessibility, and code analysis, you can click on the line that is flagged as an issue, and it will pull it up in your HTML.
Once you make updates to your code, you can easily run another preview, and you can select only the problematic previews the second time around to save usage.
And remember, you can see these tests inside of Mailgun Inspect as well.
Command reference
Run any of these from the command palette (Cmd+Shift+P / Ctrl+Shift+P).
| Command | What it does |
| Mailgun Inspect: Generate Preview | Renders the active HTML file across your selected clients |
| Mailgun Inspect: Select Clients | Choose which email clients to use by default |
| Mailgun Inspect: Set API Key | Securely stores your Mailgun API key |
| Mailgun Inspect: Open Settings | Jumps to extension settings |
Settings reference
| Setting | Default | What it does |
| mailgunInspect.region | US | Mailgun API region (US or EU). |
| mailgunInspect.defaultClients | [] | Email client IDs to use by default. |
| mailgunInspect.pollIntervalMs | 5000 | How often to poll for preview results, in milliseconds. |
| mailgunInspect.contentChecking.linkValidation | true | Runs link validation when generating previews. |
| mailgunInspect.contentChecking.imageValidation | true | Runs image validation when generating previews. |
| mailgunInspect.contentChecking.accessibility | true | Runs accessibility checks when generating previews. |
| mailgunInspect.contentChecking.codeAnalysis | true | Runs HTML/CSS compatibility analysis when generating previews. |
| mailgunInspect.contentChecking.spamTesting | true | Shows the Spam Testing tab for inbox placement testing. |
Turning individual checks off
All five content checks are on by default. If you only care about rendering, turn the others off in settings to reduce noise in the results panel — run Mailgun Inspect: Open Settings and clear the checkboxes next to each additional feature.
Troubleshooting
Authentication or "unauthorized" errors. Work through these in order: confirm your Region setting matches the region your Mailgun account lives in; confirm you used an account API key with admin permissions rather than a domain sending key; then confirm the key hasn't been disabled or deleted in API Security. If you're unsure the key pasted cleanly, re-run Mailgun Inspect: Set API Key and paste it again.
A results tab says the feature isn't enabled. That check isn't included in your current Inspect plan. See which features your plan includes above; upgrade from Plan & Billing in the Mailgun control panel to add it.
The eye icon isn't in the editor title bar. The icon only appears for files VS Code recognizes as HTML. Check the language mode in the bottom-right status bar and set it to HTML if it says something else — this commonly happens with template files that use a non-.html extension.
You're using previews faster than expected. Check how many clients you have selected. Every client in your selection consumes one preview per run, so a 100-client selection burns 100 previews each time you click the eye icon. Run Mailgun Inspect: Select Clients and trim the list.
Privacy and data handling
The extension sends the HTML of your active editor to the Mailgun Inspect API for rendering and analysis. Nothing leaves your machine until you explicitly trigger a preview — the extension doesn't watch or upload your files in the background.
The extension may collect limited telemetry to help us understand usage and improve the experience. It does not collect personal data or email content. Telemetry follows your global VS Code telemetry setting and is disabled if you've turned telemetry off in VS Code.