MailRaider Pro is scriptable. It supports both AppleScript — for traditional Mac automation and integration with other scriptable applications — and Shortcuts on macOS 13 and later, for building visual automation workflows that can run from the Shortcuts app, the menu bar, Spotlight, or on a schedule.
Both interfaces expose the same underlying capabilities: opening and searching email archives (PST, OLK, MBOX, EML, MSG), extracting content and metadata, and exporting results. AppleScript is better suited to complex data processing and integration with other applications. Shortcuts is better suited to single-action or simple chained workflows that non-developers will run regularly.
The example scripts below cover the main scripting scenarios. Each is a standalone .applescript file with detailed inline comments. Download the ones relevant to your use case, open them in Script Editor, adjust the file paths in the configuration section at the top, and run.
All data-extraction operations work without opening MailRaider’s user interface. You can process hundreds of emails per minute in “data mode” with no windows appearing on screen.
How to open an email file in MailRaider’s UI, and how to extract data (subject, sender, date, recipients, body, attachments, headers) without opening any window. Includes examples that send email content to TextEdit and open HTML bodies in a browser.
Key commands demonstrated: open email reference file, process email file … returning, get content streams from reference, get email from reference
Focused examples for extracting individual properties: subject, sender, date, recipients, body text, email headers, and attachments. Includes a worked example that assembles a formatted summary from all fields in a single call using the full return type.
Key commands demonstrated: process email file … returning "full", property access on the returned record
Use returning "full" when you need multiple fields — it is faster than making individual calls for each property.
Emails can carry their body in multiple formats (plain text, HTML, RTF). This script shows how to detect which formats are available, retrieve a specific one, save HTML to a file for browser preview, and fall back gracefully when a format is absent. Also covers simple HTML-to-plain-text conversion for use with natural language processing tools.
Key commands demonstrated: get content streams from reference, get content stream of type … from reference
RTF is typically only present in MSG files. Plain text is always available. Prefer HTML for display, plain text for analysis.
How to search a folder of email files or a PST mailbox by sender, recipient, subject, body content, and date range. Includes examples combining multiple criteria, recursive subfolder scanning, and a recent-emails shortcut that calculates the date range automatically.
Key commands demonstrated: search folder in folder … searching … for …, search mailbox in file … searching … for …, from date … to date, recursive true
PST searches use a built-in index and are fast even on large archives. Body searches on folders of individual files are slower as they require loading each email’s content.
Efficient processing of large numbers of emails. Covers basic iteration over search results, CSV export of email metadata, selective processing (e.g. only emails with attachments), building summary reports with sender statistics and date ranges, and memory-efficient batch processing in chunks of 100.
Key commands demonstrated: process email emailRef returning, get email from reference, result iteration with repeat with … in and repeat with i from 1 to
For large batches, use process email … returning (data mode) rather than open email reference (UI mode). Data mode has no UI overhead and is suitable for processing thousands of emails.
Best-practice error handling for MailRaider scripts: per-email try/catch in batch loops so a single corrupt file does not abort the entire run, error logging to disk, and structured error recovery. Also includes a multi-application workflow example combining MailRaider with TextEdit and the Finder.
Patterns demonstrated: error log accumulation, graceful skip on failure, file-handle cleanup in error handlers, progress reporting
A short, self-contained starter script. If you have not used MailRaider’s AppleScript support before, start here. Opens a single email, extracts its subject and sender, and displays a dialog. No helper functions, no complexity.
To explore MailRaider Pro’s full AppleScript dictionary, open Script Editor, choose File > Open Dictionary…, and select MailRaider Pro. The dictionary describes every command, class, and property.
On macOS 13 and later, MailRaider Pro adds the following actions to the Shortcuts app. Actions can be combined in any sequence and chained with built-in Shortcuts actions (loops, conditions, text processing, file operations, etc.).
To find MailRaider Pro’s actions in Shortcuts, open the Shortcuts app, create a new shortcut, and search for “MailRaider” in the action library on the right.
Creates an email reference from a file you select in Finder (or supply from a “Get File” action). This is the entry point for workflows that start from a specific file rather than a search result. The reference can be passed to any of the content, open, or export actions below.
Input: a file path or Finder file. Output: an Email Reference.
Searches inside a PST, OLK, or MBOX archive file. Returns a list of Email References matching the criteria.
Output: list of Email References. Pass these to “Get Email Content”, “Get Content Stream”, “Open Email”, or “Export Emails”.
Searches a folder containing individual email files (MSG, EML, OFT, winmail.dat). Returns a list of Email References matching the criteria.
Output: list of Email References.
Retrieves the full content of an email as a structured record: subject, sender, recipients, date, plain-text body, HTML body, email headers, and attachment names. Use this when you need several fields at once.
Input: an Email Reference (from Search Mailbox, Search Folder, or Email Reference from File). Output: an Email Content record with named fields.
Returns the list of body formats available in an email (e.g. “text”, “html”, “rtf”). Use before “Get Content Stream” when you are not certain which formats a particular email carries.
Input: an Email Reference. Output: a list of format name strings.
Retrieves a specific body format from an email as a text string.
Output: the body content as text. Can be passed directly to “Save File”, “Share”, a text action, or any other Shortcuts action that accepts text.
Saves one or more emails to individual files on disk.
Output: a list of paths to the exported files.
Opens an email in MailRaider Pro’s UI for reading. Use this at the end of a search-and-select workflow when you want to view the email rather than process it programmatically. This action requires MailRaider Pro to be running and brings it to the foreground.
Input: an Email Reference. Output: none (side effect: email displayed in MailRaider Pro).
The examples below describe complete Shortcuts you can build by chaining the actions above. Each is described in terms of the actions involved and what they do, in sequence.
Good for: quickly locating a specific email in a large archive from anywhere on your Mac.
Add this shortcut to the menu bar for one-click archive search from anywhere.
Good for: archiving a formatted email as a standalone HTML file, or feeding it to another tool.
Good for: pulling every email from a specific contact out of an archive for handover or review.
Good for: moving from Outlook to Apple Mail. Run this once; import the resulting MBOX into Apple Mail using File > Import Mailboxes.
For a folder-preserving MBOX export that retains your PST’s folder hierarchy, use the bulk export feature within MailRaider Pro’s UI directly (File > Bulk Export). The Shortcuts action exports individual EML files; the in-app export produces a proper nested MBOX.
Good for: a scheduled shortcut that summarises recent email in an archive.
Schedule this from the Shortcuts app using the “Run Shortcut” automation trigger.
AppleScript: MailRaider Pro, any version. No additional configuration required. The application must be running when scripts execute, or scripts must include an explicit tell application “MailRaider Pro” block (which will launch the application automatically).
Shortcuts: MailRaider Pro 5 or later, macOS 13 (Ventura) or later. MailRaider Pro’s actions appear in the Shortcuts app automatically after installation. No additional configuration is required. Actions that do not open the UI (Search Mailbox, Search Folder, Get Email Content, Get Content Stream, Export Emails) can run in the background without MailRaider Pro being the frontmost app.
Both interfaces operate within macOS’s standard sandbox permissions. The first time a script or shortcut accesses a file or folder you have not previously approved, macOS will ask for your permission. Grant it once and it will be remembered.