Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk9 min

How to Capture Screenshots of Multiple URLs and Email a Report

A Node.js guide to capturing screenshots for a URL list, recording errors in a manifest, and emailing the report with Nodemailer.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright to visit each URL and save a screenshot, record each success or failure in a manifest, then use Nodemailer to email the results through an SMTP service. The example below processes a URL list sequentially and sends an HTML summary with the images attached. You control the batch loop, report format, and failure handling; neither library guarantees that every site will load or permit a screenshot.

What the workflow produces

This Node.js workflow reads one HTTP or HTTPS URL per line from urls.txt, captures a viewport screenshot for each address, and writes the images and a JSON manifest to an output folder. It then sends an email containing a status row for every URL and attaches the screenshots that succeeded.

As an Amazon Associate I earn from qualifying purchases.

Playwright documents navigation and screenshot saving, including full-page capture, locator screenshots, and image buffers. Nodemailer supports SMTP delivery and attachments. The combination below is an implementation pattern, not a claim that the two libraries have been tested together in every environment. See the Playwright Page API, Playwright screenshot guide, Nodemailer overview, and Nodemailer attachments.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set up the script

  1. Install a current Node.js release supported by the Playwright package you choose. Package versions and compatibility can change, so check the packages’ current installation documentation when setting up a new project.
  2. In a new project directory, install the libraries: npm init -y, then npm install playwright nodemailer.
  3. Install Playwright’s Chromium browser with npx playwright install chromium. In a Linux environment, follow Playwright’s current guidance if system dependencies are also required.
  4. Create urls.txt with one URL per line, for example:
    https://example.com
    https://www.wikipedia.org/
  5. Set SMTP configuration as environment variables rather than writing credentials into the script. The SMTP host, port, TLS settings, username and password depend on your provider; use its current instructions and policies. Nodemailer documents its SMTP transport.

Complete Node.js example

Save this as bulk-report.mjs. It uses sequential navigation to keep resource use predictable, records per-URL errors instead of dropping failed addresses, and emails successful images as attachments. By default it captures the visible viewport. Set FULL_PAGE=true to capture the full scrollable page.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
import fs from 'node:fs/promises';
import path from 'node:path';
import { pathToFileURL } from 'node:url';
import { chromium } from 'playwright';
import nodemailer from 'nodemailer';

const inputFile = process.env.URLS_FILE || 'urls.txt';
const outputDir = process.env.OUTPUT_DIR || 'screenshots';
const timeoutMs = Number(process.env.PAGE_TIMEOUT_MS || 30000);
const fullPage = process.env.FULL_PAGE === 'true';

function safeName(value, index) {
  let host = 'page';
  try { host = new URL(value).hostname || host; } catch {}
  return `${String(index + 1).padStart(3, '0')}-${host.replace(/[^a-zA-Z0-9.-]/g, '_')}.png`;
}

function escapeHtml(value) {
  return String(value).replace(/[<>&"']/g, (ch) => ({
    '&': '&amp;', '<': '&lt;', '>': '&gt;',
    '"': '&quot;', "'": '&#39;'
  }[ch]));
}

const raw = await fs.readFile(inputFile, 'utf8');
const urls = raw.split(/r?n/).map(line => line.trim()).filter(line => line && !line.startsWith('#'));
if (urls.length === 0) throw new Error(`No URLs found in ${inputFile}`);

await fs.mkdir(outputDir, { recursive: true });
const results = [];
const browser = await chromium.launch({ headless: true });
try {
  const context = await browser.newContext({ viewport: { width: 1440, height: 900 } });
  for (const [index, originalUrl] of urls.entries()) {
    const startedAt = new Date().toISOString();
    let parsed;
    try {
      parsed = new URL(originalUrl);
      if (!['http:', 'https:'].includes(parsed.protocol)) throw new Error('Only HTTP and HTTPS URLs are supported');
    } catch (error) {
      results.push({ url: originalUrl, startedAt, status: 'error', error: `Invalid URL: ${error.message}` });
      continue;
    }

    const page = await context.newPage();
    try {
      const response = await page.goto(parsed.href, { waitUntil: 'domcontentloaded', timeout: timeoutMs });
      const file = path.join(outputDir, safeName(parsed.href, index));
      await page.screenshot({ path: file, fullPage });
      results.push({
        url: originalUrl,
        finalUrl: page.url(),
        httpStatus: response?.status() ?? null,
        startedAt,
        capturedAt: new Date().toISOString(),
        status: 'success',
        file
      });
    } catch (error) {
      results.push({ url: originalUrl, startedAt, status: 'error', error: error.message });
    } finally {
      await page.close();
    }
  }
  await context.close();
} finally {
  await browser.close();
}

const manifestPath = path.join(outputDir, 'manifest.json');
await fs.writeFile(manifestPath, JSON.stringify(results, null, 2));

const required = ['SMTP_HOST', 'SMTP_PORT', 'SMTP_USER', 'SMTP_PASS', 'MAIL_FROM', 'MAIL_TO'];
const missing = required.filter(name => !process.env[name]);
if (missing.length) throw new Error(`Missing mail configuration: ${missing.join(', ')}`);
const port = Number(process.env.SMTP_PORT);
const transporter = nodemailer.createTransport({
  host: process.env.SMTP_HOST,
  port,
  secure: process.env.SMTP_SECURE === 'true',
  auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS }
});

const rows = results.map((item, index) => {
  const detail = item.status === 'success'
    ? `Captured${item.httpStatus === null ? '' : ` (HTTP ${item.httpStatus})`}`
    : `Failed: ${item.error}`;
  return `<tr><td>${escapeHtml(item.url)}</td><td>${escapeHtml(detail)}</td><td>${escapeHtml(item.file || '—')}</td></tr>`;
}).join('');
const successful = results.filter(item => item.status === 'success');
const attachments = [
  { filename: 'manifest.json', path: manifestPath },
  ...successful.map(item => ({ filename: path.basename(item.file), path: item.file }))
];

await transporter.sendMail({
  from: process.env.MAIL_FROM,
  to: process.env.MAIL_TO,
  subject: `Website screenshot report: ${successful.length}/${results.length} captured`,
  text: results.map(item => `${item.status.toUpperCase()} ${item.url}${item.error ? ` — ${item.error}` : ''}`).join('n'),
  html: `<h1>Website screenshot report</h1><p>${successful.length} of ${results.length} URLs captured. See the attached images and manifest.</p><table border="1" cellpadding="6" cellspacing="0"><thead><tr><th>URL</th><th>Result</th><th>Image</th></tr></thead><tbody>${rows}</tbody></table>`,
  attachments
});
console.log(`Emailed report for ${results.length} URLs; ${successful.length} screenshots succeeded.`);

Run it with SMTP values supplied by your mail provider. For example, on a Unix-like shell, export SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, MAIL_FROM, and MAIL_TO, then run node bulk-report.mjs. Set SMTP_SECURE=true only when the provider’s SMTP configuration calls for implicit TLS on the selected port; otherwise leave it unset or set it to false. Authentication and transport requirements vary by provider.

Choose what counts as a useful screenshot

Viewport or full page

The default viewport capture shows the first visible screen at a 1440-by-900 viewport. Set FULL_PAGE=true to capture the page’s full scrollable area. Full-page images can become very tall and increase the email’s attachment size. For pages whose important content appears after scrolling, full-page capture may be more informative, but it does not make every site render all content correctly.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Wait condition and dynamic content

The example uses waitUntil: 'domcontentloaded' so it does not wait for every network request to finish. Pages that populate content later may need a targeted wait, such as waiting for a known selector before taking the screenshot. Playwright supports locator-based screenshots when only a particular element is needed; see its screenshot guide. Avoid waiting for network idle as a universal rule: pages with continuous background requests may never become idle. Choose a wait condition suited to the pages you capture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Image bytes versus files

Saving each screenshot to a file makes it straightforward to attach, archive, or inspect later. Playwright can also return screenshot image bytes for processing without first writing a file. The example favors files because its report attaches the output and retains a manifest.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Make the batch reliable and manageable

  • Keep failures visible. A timeout, HTTP error page, login screen, CAPTCHA, or browser error may produce a screenshot or an error. The script records thrown navigation or capture errors and logs HTTP response status for requests that returned a response; an HTTP error status is not automatically treated as a navigation exception.
  • Use careful concurrency. This example is sequential. If you later process multiple pages concurrently, tune the number of pages against available memory, CPU, the target sites’ behavior, and the mail size. The cited documentation does not establish a universal safe concurrency level or throughput figure.
  • Plan for retries deliberately. For transient failures, add a limited retry policy and record each attempt. Do not retry indefinitely: it can waste resources or repeatedly load a site. Consider whether retrying a URL could produce duplicate work or duplicate email deliveries if the send step is retried too.
  • Watch attachment volume. The message includes every successful image plus the manifest. Mail providers impose their own message-size rules; no universal limit applies. Nodemailer supports paths and streams for attachments, which avoids requiring the script to load every file’s contents into memory, but streaming does not bypass provider size limits. For oversized reports, upload files to storage you are authorized to use and email an access-controlled link instead.
  • Protect access and credentials. Treat URLs, screenshots, SMTP passwords, and the report as potentially sensitive. Restrict access to the output directory, avoid logging secrets, and verify recipients before running a batch.
  • Validate input and output. The script ignores blank lines and lines beginning with #; it rejects non-HTTP(S) URLs. The manifest records original URL, final URL when available, capture time, HTTP status, output filename, or error.

Troubleshooting

Symptom Likely cause What to do
Chromium executable is missing The Playwright package is installed but its browser has not been downloaded, or the environment lacks required system dependencies. Run npx playwright install chromium; on Linux, follow Playwright’s current browser dependency instructions.
Navigation times out The site is slow, unreachable, blocking automation, or the selected wait condition takes too long. Check the URL manually from the same environment, increase PAGE_TIMEOUT_MS for genuinely slow pages, or use a more appropriate readiness condition. A timeout does not prove the page is permanently unavailable.
Screenshot is blank or incomplete The page may render content after navigation, require interaction or authentication, or block the automated browser. Wait for a meaningful selector or perform the required interaction where authorized. Inspect the captured image and manifest; do not assume a successful navigation means the page is fully rendered.
Some URLs are absent from the images The URL failed validation or navigation/capture threw an error. Check the corresponding manifest row; failures are recorded rather than attached as successful screenshots.
SMTP authentication or connection fails Host, port, TLS mode, credentials, or provider account policy is incorrect. Compare the environment variables with the mail provider’s current SMTP instructions and verify account-specific authentication requirements. Nodemailer documents SMTP configuration at its SMTP transport page.
Email is rejected or does not arrive Recipient address, sender policy, delivery policy, or message size may be at fault. Check the SMTP response and provider logs, confirm the recipient, and consult the provider’s current size and sending rules. If the attachments exceed its limit, send a controlled download link instead.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For a screenshot request without managing Playwright and Chromium, ScreenshotNeo accepts a URL in a single GET request and returns an image or PDF. For example, save one capture with cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

See the ScreenshotNeo API documentation for authentication and request options. For bulk email reports, your script still needs to iterate through the URL list, collect the returned files and send the email; the call above captures one URL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Cookie/consent banners are accepted before capture and more than 60 known consent platforms, newsletter popups, and chat widgets are removed; each step can be turned off.
  • Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; responses include X-Page-Verdict and X-Billed headers.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents.
  • The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. Sign up for 1,000 free screenshots a month, with no card required.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Frequently Asked Questions

Does this script capture screenshots concurrently?

No. It processes URLs sequentially; adding concurrency requires an explicit limit appropriate to your machine and target sites.

Will every URL produce a usable image?

No. Site behavior, access requirements, rendering, and network conditions vary. The manifest makes errors and returned HTTP statuses visible.

Can I email a PDF instead of separate image files?

The example attaches PNG files and a JSON manifest. Creating a PDF report requires an additional document-generation step; alternatively, ScreenshotNeo’s API supports returning a PDF.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.