⌨️ Mail Attachment Downloader 4.0

Automatically trigger PowerShell scripts from email.

Mail Attachment Downloader 4.0 runs your PowerShell script, batch file or program when the right email arrives, for each attachment it saved or once per email, with the sender, the subject, the saved file's path and any value read from the email passed as arguments. The script does what only your systems know how to do; the program handles the mailbox, the rules and the retries. It runs on your Windows server as a service.

PowerShellWindows PowerShell or pwsh 7
Your ArgumentsAny field from the email
Exit CodesNon-zero fails the step
24x7As a Windows service
PowerShell 5.1
PowerShell 7 (pwsh)
Batch files
Any .exe
Python and others
Gmail & Microsoft 365
Exchange & IMAP
Use Case 1

Your PowerShell script, with the email's values

The Run a script step starts a program with the arguments you write, filled from the rule's fields.

📖 See the feature

Run a script

  • Program: powershell.exe (Windows PowerShell) or pwsh.exe (PowerShell 7), the full path, without quotes.
  • Arguments: -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\Import-Invoice.ps1" -Path "{SAVE_FILE}" -Supplier "{SUPPLIER}"
  • Any field as a parameter: {EMAIL_FROM}, {SUBJECT}, {DATE[yyyy-MM-dd]}, the saved file ({SAVE_FILE}) and its folder ({SAVE_PATH}), or a value read from the PDF.
  • Run: for each saved file, once per email, or both.
  • Run it once (test) tries it on the spot; the script's output goes to the log.

The Run a command line step does the same through cmd, for a .bat file or a one-line command.

A Run a command line step in a rule for supplier invoices: the program C:\Tools\ArchiveInvoice.exe with the supplier and the saved file's path as arguments, run for each saved file.

The program and its arguments, filled from the rule's fields (here Run a command line).

Use Case 2

Failures you can see

A script that fails shouldn't fail quietly.

🚦

Exit codes count

A script that exits with a code other than 0 fails the step: the rule's If something fails steps run, such as moving the email to Needs attention.

⏱️

A timeout

A script that hangs is stopped after the timeout you set (5 minutes by default) and the step fails.

🧾

In History

Each run is in Activity and History, and the script's output in the log, so you can see what it was given and what it said.

Use Case 3

What people run

Anything a script can do on your network, started by the email it needs.

🏭

Import into a line-of-business system

Hand the saved order or invoice file to an import tool, an ERP command line or a stored procedure the email's values select.

🗂️

Provision and file

Make the project folder, set its permissions in Active Directory or SharePoint, and move the attachments in, from a request email.

🖨️

Kick off a job

Start a report, a print run, a sync or a backup when the email that says "ready" arrives, from a monitoring system or a partner.

How it fits together

From the inbox to your script

Rules pick the emails, save the files and run the script, as mail arrives.

1

An email arrives

Any mailbox, any provider

2

A rule matches it

Sender, subject, attachment name

3

Files are saved

And values read from them

4

Your script runs

With them as arguments

Why rules and AI, not just AI?

An AI agent could be given a shell and told to react to emails, but it reads every email through its service, spends tokens each time, and could run something different from what you meant. A rule runs exactly the script you chose, with exactly the arguments you wrote, and records each run. AI, if you want it, only reads values out of the email for the arguments, such as an order number. How rules and AI work together

How it stacks up

PRO vs. the usual ways to start a script from email

A scheduled script that polls the mailbox works until the sign-in, the mailbox or its author changes.

CapabilityMail Attachment
Downloader PRO
A polling script
you maintain
Outlook rules
(run a script)
Cloud automation
(Zapier-style)
Gmail, Microsoft 365, Exchange and any IMAP mailbox, with sign-in handled✓You write itOutlook onlyVaries by connector
Runs with no one signed in, as a Windows service✓✓✗Runs in their cloud
Attachments saved first, their paths passed in✓You write itYou write it✗
Values read out of the email and its PDFs as arguments✓You write it✗With some work
Each email once, and a record of every run✓You write itVaries✓
Any number of emails and runs, with no per-task fees✓✓✓Usually billed per task or run
Questions

Frequently asked questions

How do I run a .ps1 file?

Set Program to powershell.exe (Windows PowerShell 5.1) or pwsh.exe (PowerShell 7), and put -File with your script's path and its parameters in Arguments, such as -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\Import-Invoice.ps1" -Path "{SAVE_FILE}".

How does the script get the email's values?

As command-line arguments, filled from the rule's fields: the sender, subject, date, the saved file's path and folder, and any value read from the email or its files. Quote each one, as in "{SUBJECT}".

Can the script's output be used in later steps?

Not as fields: the output goes to the log. A script that needs to hand something back can write a file the rule or a watch picks up, or call the Web hook step's API itself.

What account does the script run as?

The account that runs the program: you, in the app, or the Windows service's account with PRO Rules Server. Give that account the rights the script needs, and no more.

What happens when the script fails?

A non-zero exit code, or running past the timeout, fails the step. The rule's If something fails steps then run, and History records it.

Which edition do I need?

PRO Rules Server, which has Run a script and Run a command line, and the Windows service that runs them around the clock with no one signed in.

What you get

Which edition does what

Each edition includes everything in the ones before it: Free, PRO Backup, PRO Parser, PRO Rules Client, PRO Rules Server.

✓ Run a script

PowerShell, Python or any program, with the email's values as arguments. PRO Rules Server.

✓ Run a command line

A .bat file or a command through cmd. PRO Rules Server.

✓ Web hook

Call an API instead of, or as well as, a script. PRO Rules Server.

✓ Find fields with AI or patterns

Values from the email and its PDFs, for the arguments. PRO Rules Client and up.

✓ Rules and conditions

Only the emails you want, by sender, subject, account or attachment. PRO Rules Client and up.

✓ Around the clock

The Windows service runs it with no one signed in. PRO Rules Server.

Related use cases

Other integrations

Let the right email start your script

Start the 30-day trial, add a Run a script step, and run it once on a sample email.