Watch folder and process files automatically: SharePoint, S3, Teams

Watch a folder and process files automatically: Mail Attachment Downloader runs new files from shares, SharePoint, S3, Teams or Slack through your rules.

To watch a folder and process files automatically, add a watch in Mail Attachment Downloader. It checks a folder, a network share, a SharePoint library, OneDrive or an S3 bucket about every 60 seconds and sends each new file through your PRO Rules, the same rules that handle email attachments: rename it, read it, convert it, upload it, tell someone.

The examples use Contoso’s scanner share \\fileserver\Finance\Scans, the Finance SharePoint and invoices from Acme.

What can you watch?

A watch works like an email account, but its source is something else. Each new file, row or message becomes an “email” for your rules: a file is its attachment and its name the subject, so conditions such as the attachment name work as they do for mail.

  • Folder or network share: a local folder or \\server\share\folder, such as the one a scanner or another program drops files into.
  • Cloud folder: SharePoint, OneDrive, Amazon S3 and S3-compatible storage (Wasabi, Backblaze B2, MinIO and others), or a network share with its own sign-in.
  • DocuSign: envelopes that everybody has signed, with the signed documents as the attachments.
  • Database table: its new rows, and changed rows if the table has a “last changed” time column and a row ID column.
  • Slack and Microsoft Teams channels: their messages, with the files posted in them.

Azure Blob, WebDAV, SFTP, FTPS, Google Drive and Dropbox can be uploaded to, but not watched yet.

What you need

  • Folders, shares, cloud folders and DocuSign: PRO Rules Client or PRO Rules Server.
  • Database tables, Slack and Teams: PRO Rules Server.
  • Windows: Windows 10 or later, 64-bit, on a PC, a server or a cloud VM. Watches don’t count toward the number of email accounts.

How to watch a folder and process new files

1. Add the watch

Click Add account and choose Watch a folder or network share. The same menu has the cloud folder, the database table, Slack, Teams and DocuSign. You can also add one in Settings › Sources › Watches with Add….

Mail Attachment Downloader's Add account menu: Email account, Watch a folder or network share, Watch a cloud folder (SharePoint, OneDrive, S3), Watch a database table's new rows, Watch Slack channels, Watch Microsoft Teams channels and Watch DocuSign for signed envelopes
Add account: email accounts and every kind of watch start here.

2. Choose the folder and when it runs

  • Folder: type it or click Browse…. Use \\server\share rather than a mapped drive letter: the Windows service can’t see mapped drives.
  • Watch name: such as “Scans”. Rules and History know the watch by this name.
  • Run as soon as something changes: on by default. It checks every Seconds between checks (60), and a folder also hears Windows’ own file events, so a file dropped in runs at once. The schedule runs it too.
  • Include the folders inside it: watch the subfolders as well.
  • Also take the files already there: off, the watch takes only what arrives after you save it. On, its first run takes everything in the folder.

Click Test to see what the watch can reach, then Save.

Watch a folder and process files automatically: the Watch Folder window of Mail Attachment Downloader with the network share \\nas\scans, Run as soon as something changes, 60 seconds between checks, Include the folders inside it, and Also take the files already there off
A folder watch on a scanner share: each new scan goes through your rules.

3. Make a rule for it

When you save a new watch, the program offers to make a rule just for it. The rule starts with an Account condition that names the watch; you add what to do with its files under Save and Then. For a scanner share that could be:

  • Make PDFs searchable (OCR) (PRO Rules Server), see make scanned PDFs searchable.
  • Find fields with AI to read the invoice number and total, see process invoices automatically.
  • Upload to cloud to put the result in SharePoint.
  • Move or copy the email, which for a watch moves the file into a folder inside the watched one, such as Processed. Delete the email deletes the file.

Rules without an Account condition run for every account and watch. A watch with no rule saves its files to its own save folder, as an account saves attachments.

How does a watch know what’s new?

  • Each check is small: nothing new, no run, so the Downloads tab doesn’t fill with empty runs.
  • A changed file counts as new: a new version goes through the rules again, under its own name.
  • Half-written files wait: a file still being copied is left for the next run.
  • No loops: files your rules write into the watched folder, such as the Processed folder, are left alone.
  • Nothing twice: each watch has its own History, with its runs in the Downloads tab, and a failed step is tried again.

SharePoint folder automation (and OneDrive and S3)

Choose Watch a cloud folder (SharePoint, OneDrive, S3). Pick a Cloud connection, the same ones the Upload to cloud step uses (Manage… adds one in Cloud Connections), then Browse… to the library and folder, such as finance › Contracts. Each check is one small request to the service.

SharePoint folder automation: the Watch Cloud folder window of Mail Attachment Downloader with the Cloud connection Finance SharePoint, the folder finance › Contracts, Run as soon as something changes and 60 seconds between checks
A SharePoint library watch: new contracts go through your rules.

Handy for taking documents out of one system and handing them to another: a contract saved in SharePoint is read, renamed and sent to document management, or a file in an S3 bucket goes to a share and is moved to Processed.

Process files from a Microsoft Teams channel

Choose Watch Microsoft Teams channels, enter your Microsoft account and click Sign in…. Reading channel messages needs an administrator’s consent once in most organizations. Each message goes through your rules as an email from its sender, its text as the body and its files as attachments. The channel is the mailbox folder, so Choose channels… in the folder pane picks the channels to read, and a rule can pick one by its folder.

Process files from a Microsoft Teams channel: the Watch Microsoft Teams window of Mail Attachment Downloader with the Microsoft account box, Sign in, and Also take the messages already posted
A Teams watch: channel messages and their files go through your rules as emails.

Slack works the same way with Watch Slack channels: make a Slack app with the read scopes the window lists, paste its Bot token, and invite the bot to the channels. Messages from apps and bots are left out, so a rule that posts to the channel it watches doesn’t start itself again.

The Watch Slack window of Mail Attachment Downloader: the Slack app scopes to give, the Bot token box, Make a Slack app, and Also take the messages already posted
A Slack watch reads the channels its bot was invited to.

Signed DocuSign envelopes and new database rows

Watch DocuSign for signed envelopes takes each envelope everybody has signed. Under Take, choose The signed documents as one PDF, Each document and The certificate of completion. Sent by limits it to one sender, and it can take only the envelopes the program sent with Send for signature.

The Watch DocuSign window of Mail Attachment Downloader: DocuSign connection, Take the signed documents as one PDF, each document or the certificate of completion, Sent by, and Also take the envelopes already completed
A DocuSign watch: signed contracts are filed without anyone downloading them.

Watch a database table’s new rows reads a table through one of your ODBC Data Sources. Pick the Table and the column in New rows by, such as an ID that grows. Each row becomes an email whose attachment is the row as a .json file, and each column is a field, such as {OrderId}, for file names and steps.

The Watch Database table window of Mail Attachment Downloader: Data source Orders DB, Table dbo.Orders, New rows by OrderId, Row ID none, and 60 seconds between checks
A database watch: each new order row goes through your rules.

Watch around the clock

Watches run while Mail Attachment Downloader is open. To run them 24×7, even when nobody is signed in, install the Windows service with PRO Rules Server. The service runs as Local System, which can’t open most shares: give it a share as a cloud connection with its own sign-in. Want to know when tonight’s file doesn’t come? Tick Check for missing files on the watch’s rule, see alerts for missing emails and files.

Questions people ask

Does it process the files already in the folder?

Only if you tick Also take the files already there. Otherwise the watch starts with what arrives after you save it.

How fast does it pick up a new file?

A local folder or share reacts at once to Windows’ file events. Cloud folders, Teams, Slack, DocuSign and tables are checked every 60 seconds, or as often as you set.

Can it move processed files to another folder?

Yes. Move or copy the email moves the file into a folder inside the watched one, on a folder, share, S3 or SharePoint. Or copy it anywhere with an upload or copy step.

Can it watch Google Drive or Dropbox?

Not yet. They can be uploaded to, but not watched.

Try it: download Mail Attachment Downloader and start with the free edition, or compare the PRO editions, each with a 30-day money-back guarantee.

Related

Questions about this post? Contact us.

Email to webhook: send email data and attachments to an API or Zapier automatically

Email to webhook, automatically: Mail Attachment Downloader sends invoice data, fields and attachments from email to any API or a Zapier Zap.

To send email to a webhook, let a rule pick the emails and add a Web hook step to it. Mail Attachment Downloader then calls your web address for each email or saved file, with a body built from the email’s fields and the values it found, and the attachments too if you want them. For Zapier there is a ready-made Send to Zapier step that starts a Zap the same way.

The examples use Contoso’s mailbox finance@contoso.com, invoices from Acme and Northwind, and invoice numbers like INV-2026-0423.

What can you do with email to webhook?

Anything a system does when it is called. Some common ones:

  • Post invoice data to an accounting API: the invoice number, due date and total from Acme’s PDF go to your accounting system as a new bill, with the PDF attached.
  • Start a Zap: Zapier adds a row to a Google Sheet, creates a task in your task app or posts to a channel for each order email.
  • Open a ticket: a support or service desk system gets the sender, subject and text of each email to a shared mailbox.
  • Hand a file to another program: an internal service that reads, checks or stores documents.

What you need

  • The edition: Web hook, Send to Zapier, Run a script and Run a command line are steps of PRO Rules Server.
  • Windows: Windows 10 or later, 64-bit, on a PC, a server or a cloud VM. No Outlook needed.
  • The mailbox: Gmail, Google Workspace, Microsoft 365, Outlook.com, Exchange, or any IMAP or POP3 mailbox.
  • The address: the web address (endpoint) to call, and its key or token if it needs one.

How to send email data to an API with the Web hook step

1. Make a rule and find the values

On the PRO Rules tab, click New rule…. Under Which emails, add a condition such as the sender’s domain acme.example, and under Save, save the attachments. New to rules? Save emails and attachments to folders walks through a first one.

The email’s own details are fields already: {FROM}, {SUBJECT}, {DATE} and many more (see fields). Values inside the attachment, such as the invoice number or the total, come from Find fields in the file (patterns), Find fields with AI or the Parser. Put the web hook after or inside that step, so it can use them.

Rule Editor of Mail Attachment Downloader for the rule Scanned invoices: Find fields with AI fills INVOICE_NUMBER, DUE_DATE and TOTAL_INCLUDING_TAX, and the Web hook step inside it sends the values to an API
Find fields with AI reads the invoice; the Web hook step inside it sends the values on.

2. Add the Web hook step

Under Then, click Add a step…, choose Other systems and double-click Web hook. Select a step first to add the new one after it or inside it; Add it says where.

Add a step window in Mail Attachment Downloader with Other systems chosen: Upload to cloud, Send to document management, Send for signature, Send to Zapier and Web hook, the step that sends email data to an API
Add a step › Other systems › Web hook.

3. Set the address, method and body

  • Address: the web address to call, such as https://erp.contoso.com/api/bills. Fields work here too; their values are URL-encoded, so ?invoice={INVOICE_NUMBER} is safe.
  • Method: POST (the default), PUT, PATCH, GET or DELETE.
  • Content type: application/json by default; XML, plain text, a form and others are in the list.
  • Body: what is sent, with fields in it. Click Fields… to pick one.

A body for Acme’s invoice could be:

{
  "invoice": "{INVOICE_NUMBER}",
  "supplier": "{EMAIL_FROM}",
  "due": "{DUE_DATE}",
  "total": "{TOTAL_INCLUDING_TAX}"
}

Each value is escaped for where it goes, so a value with quotes or a line break can’t break the JSON. Run decides how often it is called: For each saved file (the default) or Once per email.

Mail Attachment Downloader's Web hook step on the rule Acme invoices: POST to https://erp.contoso.com/api/bills as JSON with the invoice number, supplier, due date and total from the email's fields, the saved file sent along, the answer kept in {BILL}, an Authorization header, a 30-second timeout and 3 retries
The Web hook step: send the email’s fields as JSON to any API, with the file, headers and retries.

4. Headers, files and retries

  • Send files: None: only the body, The file it runs for, or Every file the rule saved from the email so far. With files, the call is sent as a form: the body in a field named payload, and each file as a file.
  • Headers: under More options, Add a header adds one, such as Authorization with Bearer and your API key, or an API key header your service asks for.
  • Timeout (seconds) and Retries: 30 seconds and 3 retries by default. A call that gets no connection, no answer in time, or HTTP 408, 429 or a server error is tried again after 2, 4, 8… seconds. An answer like 400 or 401 isn’t, since the same call would get the same answer.

If it still fails, the step fails: the Downloads tab shows it, the steps under If something fails run, and the email’s History tries the step again later. History also keeps the address without its query, which can hold a key.

5. Test it

Click Test the web hook. It calls the address once with a sample email’s values and shows the answer. Then click Save, and Test this rule… to see which emails the rule picks; the test only describes the call, it doesn’t make it.

Keep fields from the API’s answer

The answer is kept in the field named in Save the answer in, such as {BILL}. Steps inside the web hook, and the steps after it, can use it. When the answer is JSON, a Fill a template (Handlebars) step picks out what you need: with {{id}} as its template, the bill’s ID from your accounting system becomes a field for a file name, a database row or a notification.

How do I send email to Zapier?

With Send to Zapier. It is the web hook step set up for a Zap that starts with Webhooks by Zapier, so there is no method or content type to choose.

  1. In Zapier, make a Zap with Webhooks by Zapier and the Catch Hook event, and copy its web address.
  2. In the rule, click Add a step… › Other systems › Send to Zapier.
  3. Paste the address into Zap’s address.
  4. Check Fields to send. It starts with the sender, subject, date, account and save path, plus the fields your rule finds. Add more with Fields….
  5. Click Send a sample to Zapier, then Test trigger in Zapier to see the fields.
Add a step window with the Send to Zapier step selected: starts a Zap with the email's fields (Webhooks by Zapier, Catch Hook)
Send to Zapier is in Add a step › Other systems.

It runs Once per email. Files go only if you choose them under More options; the step says what leaves the computer: the fields to send, and those files, to hooks.zapier.com.

Send to Zapier step in the Rule Editor for the rule Orders to Zapier: Zap's address https://hooks.zapier.com/hooks/catch/..., Fields to send with from, subject, date, account_email and save_path, Run Once per email, and Send a sample to Zapier
Send to Zapier: paste the Zap’s address and choose the fields to send.

In Zapier, add the actions that use the fields: Google Sheets’ “Create Spreadsheet Row” to log each Northwind order, or a task app’s create-task action with the subject as the task name. Same retries as the web hook, and the answer is kept the same way.

Run a script or a command line instead

When the work is on your own system rather than behind a web address, use Add a step… › Programs:

  • Run a script: a PowerShell script, a .bat or .cmd file, or a program, with the fields in its Arguments, and a Timeout (seconds).
  • Run a command line: a program or a .bat file, with arguments such as --supplier "{SUPPLIER}" --file "{SAVE_PATH}\{FILENAMEEXT}".

Click Run it once (test) to try it with a sample email’s values. Both are PRO Rules Server steps. More in email actions: run a script.

Run a command line step in the Rule Editor for the rule Supplier invoices: Command C:\Tools\ArchiveInvoice.exe, Arguments with the SUPPLIER, SAVE_PATH and FILENAMEEXT fields, Run For each saved file, and Run it once (test)
Run a command line: a program gets the fields as arguments.

Questions people ask

Can I send email attachments to a webhook?

Yes. Set Send files to The file it runs for or Every file the rule saved from the email so far. They are sent as a form upload with the body.

Does it work with Make, n8n or Power Automate?

Any service that gives you a web address to call works with the Web hook step. Send to Zapier is only a shortcut for Zapier.

Will the same email be sent twice?

No. Each account’s History remembers the emails it has handled, so the next run doesn’t call the address for them again.

Does the program have to be running?

Yes, or run it as the Windows service of PRO Rules Server, which works 24×7, even when nobody is signed in.

Try it: download Mail Attachment Downloader and start with the free edition, or compare the PRO editions, each with a 30-day money-back guarantee.

Related

Questions about this post? Contact us.

Email attachments to DocuSign automatically: send documents for signature and file the signed copies

Send email attachments to DocuSign automatically: Mail Attachment Downloader makes the envelope, adds signers and anchors, and files the signed PDF.

To send email attachments to DocuSign automatically, let a rule pick the emails and add the Send for signature step. Mail Attachment Downloader makes a DocuSign envelope of each saved file (or of all the email’s files), sends it to the signers you name or the ones the email names, and can place the signature on a marked spot. When everybody has signed, a DocuSign watch takes the signed PDF back and your rules file it like an attachment.

New in version 4.0. The examples use Contoso’s mailbox contracts@contoso.com, contracts from Acme and Fabrikam, and the folder \\fileserver\Contracts\Signed.

What can you automate with DocuSign?

  • Contracts from sales: a signed-off contract emailed to contracts@contoso.com goes to the customer for signature, then to your manager.
  • Supplier agreements: Acme sends its agreement; Contoso’s signer gets it at once, without anyone uploading it to DocuSign.
  • Forms from a system: an HR or ERP system emails a PDF to sign; it goes out with a DocuSign template’s roles.
  • The signed copies: completed envelopes are saved, renamed and filed, or sent on to DocuWare, Laserfiche or M-Files.

What you need

  • The edition: PRO Rules Client or PRO Rules Server. Send for signature and the DocuSign watch are part of PRO Rules.
  • DocuSign: an account that may send envelopes, on the production service or in DocuSign’s demo sandbox to try it first.
  • Windows: Windows 10 or later, 64-bit, on a PC, a server or a cloud VM.
  • The mailbox: Gmail, Google Workspace, Microsoft 365, Outlook.com, Exchange, or any IMAP or POP3 mailbox.

Step 1: Connect DocuSign once

Open Settings › Sources › Document Management, click Add… and choose DocuSign. You need an integration key, which you add in DocuSign under Settings › Apps and Keys; Where to find these values shows where each value is. Sign in with offers two ways:

  • Integration key with the user’s consent: nobody has to be signed in, also when the Windows service runs it. Enter the Integration key, the API user ID and the key’s RSA Private key (or Load file…), then click Give consent… once and allow it as the API user.
  • Sign in in the browser: you sign in at DocuSign as yourself. The sign-in is kept, encrypted, and renewed on its own.

Leave Environment empty for production, or enter demo for the developer sandbox. List finds the Account. Name the connection, such as “Contoso DocuSign”, and click Test.

New DocuSign connection window in Mail Attachment Downloader for DocuSign automation: Sign in with Integration key with the user's consent, Environment production or demo, Account with List, Integration key, API user ID, Private key with Load file, Redirect port, Give consent and Test
A DocuSign connection: production or the demo sandbox, with nobody signed in.

Step 2: Add Send for signature to a rule

  1. On the PRO Rules tab, click New rule…. Under Which emails, add a condition, such as “to sign” in the subject, or the folder Contracts. New to rules? Save emails and attachments to folders walks through one.
  2. Under Save, save the attachments. Only PDFs? Add an attachment name condition such as \.pdf$.
  3. Under Then, click Add a step…, open Other systems and double-click Send for signature.
Add a step window with Other systems chosen: Send for signature sends the saved files for signature with DocuSign, next to Upload to cloud, Send to document management, Send to Zapier and Web hook
Add a step › Other systems › Send for signature.

Signers, routing order and signature anchors

Pick the Connection (Manage… adds one). Under Recipients, the step starts with one signer: the email’s sender. Add a signer adds more, and Add a copy adds someone who gets the signed document but doesn’t sign. For each one:

  • Name and Email: fixed, such as legal@contoso.com, or from a field. {EMAIL_FROM} is the sender’s address; a field the rule found, such as {SIGNER_EMAIL} from the contract, works too.
  • Order: the routing order. Signers with the same number are asked together; a higher number is asked after the lower ones signed. With 0, signers are asked together and copies go after them.
  • Where it’s signed: a signature anchor, text in the document such as /sn1/, where this signer’s signature goes. Empty: the signer places it.

Then the envelope itself:

  • Subject and Message: what DocuSign’s email says, with fields if you like. An empty subject reads “Please sign:” and the file’s name.
  • Each envelope holds: one saved file (each attachment is an envelope), or the email’s saved files together in one envelope.
  • Leave it as a draft in DocuSign: a person checks the envelope in DocuSign and sends it.
  • Test the connection: signs in and finds the account (and the template). It sends nothing.
Mail Attachment Downloader's Send for signature step on the rule Contracts to sign: the Contoso DocuSign connection, two signers (Acme Legal from the email, order 1, signing at /sn1/; Contoso Finance, order 2) and a copy to Contoso Legal, the subject Please sign: {SUBJECT} and a message
Send for signature: signers from the email or fixed, their order, and where each one signs.

DocuSign templates and roles

Already have a DocuSign template with its fields and tabs? Click List the templates and choose it under Template. Each recipient then takes one of the template’s roles in Template role, such as Client or Manager, with the name and email filled from the email or fixed.

No envelope sent twice

If the email comes again, for example after a Redo, the default sends nothing while an envelope is out for the file. You can send another only if the earlier one was voided, declined or timed out, or send one each time. Before you turn the rule on, click Test this rule…: it shows which emails the rule picks and only describes the envelope, without sending it.

Test rule window in Mail Attachment Downloader: emails from Acme, Northwind and Fabrikam marked Matched, Taken by another rule or Not matched; steps that reach outside the computer, such as sending for signature, are only described
Test this rule: see which emails would be sent for signature, without sending anything.

Step 3: Take the signed documents back with a DocuSign watch

A watch works like a mail account whose new items are completed envelopes. Open Settings › Sources › Watches, click Add… and choose DocuSign: signed envelopes.

  • DocuSign connection: the same connection (New… adds one).
  • Take: The signed documents as one PDF, Each document, and The certificate of completion if you keep it.
  • Envelopes: only the envelopes sent by Send for signature, or all of them. Sent by limits it to one sender’s envelopes.
  • When it runs: Run as soon as something changes, with a check every 60 seconds. A new watch takes only envelopes completed after it is saved, unless you tick Also take the envelopes already completed.
DocuSign watch window (DocuSign: signed envelopes): DocuSign connection, Take the signed documents as one PDF, each document or the certificate of completion, only the envelopes sent by Send for signature, Sent by, Run as soon as something changes, Seconds between checks 60
The DocuSign watch takes completed envelopes, signed PDFs and all.

Each completed envelope then goes through your PRO Rules like an email from its sender, with the signed documents as the attachments. In a rule for the watch (an Account condition with the watch’s name), Which emails reads Which envelopes, and fields such as {DOCUSIGN_SIGNERS}, {DOCUSIGN_COMPLETED} and {DOCUSIGN_ENVELOPE_ID} name and file the PDF, for example in \\fileserver\Contracts\Signed\{DATE[yyyy]}. Steps such as Upload to cloud or Send to document management can follow. The watch has History too, so an envelope is taken once.

Questions people ask

Can I send an email attachment to DocuSign automatically without opening DocuSign?

Yes. The rule makes and sends the envelope on its own. Tick Leave it as a draft in DocuSign if someone should look first.

Does it work with the DocuSign developer sandbox?

Yes. Enter demo as the Environment of the connection; leave it empty for production.

Does it work with Adobe Sign or other e-signature services?

Not directly: DocuSign is the e-signature service the step supports. For others, a web hook or Zapier step can hand the file to their API.

Does the program have to run while people sign?

Only to send and to take the signed envelopes back. For 24×7, even when nobody is signed in, use the Windows service of PRO Rules Server with the integration key sign-in.

Try it: download Mail Attachment Downloader and start with the free edition, or compare the PRO editions, each with a 30-day money-back guarantee.

Related

Questions about this post? Contact us.

MCP server for email attachments: let AI agents read your downloads

MCP server for email attachments: let GitHub Copilot, Claude Code or any AI agent ask what was saved, what failed and what needs you. Read-only, local.

Mail Attachment Downloader has a built-in MCP server for your email attachments. Switch on AI agents, and GitHub Copilot in Visual Studio Code, Claude Code, Gemini CLI or any other MCP agent on the same system can ask which files were saved, which downloads failed and which accounts need you. It only reads, it is off until you turn it on, it listens on your own system only, and an agent needs a token.

The examples use Contoso’s mailboxes finance@contoso.com and ap@contoso.com, invoices from Acme and Northwind, and the parser Supplier invoices.

What can you ask an AI agent about your email downloads?

MCP (Model Context Protocol) is the way AI agents call tools. With the server on, you ask in your own words and the agent picks the tool. For example:

  • “Which invoices from Acme were saved this week, and in which folder?”
  • “Did any downloads fail since Monday? Why?”
  • “Which accounts need me to sign in again?”
  • “How many files did each rule save in the last 7 days?”
  • “How is the Supplier invoices parser doing, and what is waiting for review?”

It saves you opening the program to look, and it lets an agent use the answer in the work it is doing, such as a report or a script that reads the saved files.

What you need

  • The edition: any PRO edition, from PRO Backup up. The Parser tools come with PRO Parser and up.
  • The program open: the server runs in Mail Attachment Downloader’s window, not in the Windows service. While the window is open it also reads what the service downloaded.
  • An agent: on the same system, one that speaks MCP over HTTP: GitHub Copilot in VS Code, Claude Code, Gemini CLI or another.

How to turn on the MCP server

  1. Open Settings › Sources › AI Agents (MCP server), pick AI agents (MCP) and click Edit….
  2. Tick Let AI agents on this computer ask what I’ve downloaded (MCP server).
  3. Keep the Port (17820) unless another program uses it. A Token is made for you; Show and Copy it, or New token… to replace it.
  4. Under What agents may see, choose what to share (below).
  5. Click OK. The server starts at once.
MCP server for email attachments: the AI agents window of Mail Attachment Downloader with Let AI agents on this computer ask what I've downloaded ticked, port 17820, a hidden token, What agents may see, and Copy VS Code setup, Copy Claude Code command, Copy Gemini CLI command and Copy address and token
The AI agents window: on, local, with a token, and you choose what agents see.

Connect GitHub Copilot, Claude Code or Gemini CLI

Under Connect an agent, one click copies what each agent needs:

  • GitHub Copilot in VS Code: Copy VS Code setup copies the server’s entry for VS Code’s mcp.json, with the address and the token. Paste it in, start the server in VS Code, and ask Copilot in agent mode.
  • Claude Code: Copy Claude Code command copies a claude mcp add command to run once in a terminal.
  • Gemini CLI: Copy Gemini CLI command copies the matching gemini mcp add command.
  • Any other MCP agent: Copy address and token. The address is http://127.0.0.1:17820/mcp, and the token goes in an Authorization: Bearer header.

What you copy holds the token: keep it to yourself, as you would a password.

What can an AI agent read?

Seven tools tell an agent about your downloads, from the same History the Downloads tab shows:

  • Status: the version and edition, whether a download is running, the accounts and the latest runs.
  • Accounts and runs: the accounts set up, and for each run who started it, how it ended, files saved and failed.
  • Search saved files: by words, account, rule, run or time, or only the problems.
  • Summary: counts for the last days, by account and by rule.
  • Needs action: accounts that can’t download until you fix something, such as an expired sign-in or a save folder that can’t be reached, with what to do.
  • Rules: what your rules do, in plain words: which emails, what they save, where, and the kinds of their steps.
AI agent read email downloads: the History of saved files in Mail Attachment Downloader, with invoices such as INV-2026-0412.pdf saved to D:\Finance\Invoices, their size, date processed, status Saved or Replaced, the rule and the run
What an agent searches: the saved files, where they went, and how each one ended.

With PRO Parser and up, six more tools cover the Parser: the parsers and their fields, one parser in detail, its health (how often each field was found), what waits for review, the latest results, and a test of a parser’s patterns on a text the agent gives.

The Results of the Supplier invoices parser in Mail Attachment Downloader: invoice number, supplier, due date and total read from emails from Acme, Northwind, Fabrikam and Contoso, each Done
The values a parser read: hidden from agents unless you allow them.

What agents may see, and what they never see

You decide under What agents may see, and a change counts at once:

  • Who sent each email, who it went to and its subject: off, they are neither shown nor searched.
  • The full path of each saved file (off: only its name).
  • What my rules do (their conditions, folders and kinds of actions): also needed for the Parser tools.
  • Let agents read the values the parsers read out of emails: off by default, as names, amounts and addresses can be personal data. Then at most 50 records at a time.

Never shared: the text of your emails, the files themselves, passwords, connection details, and where a rule or parser sends data. File names, times and the status of each download always are.

Keep in mind that what an agent reads goes to the AI model the agent uses, as any tool result does. Share only what you are happy for that model to see.

What it can’t do

The server only reads. No tool starts a download, changes a setting, touches a file, or approves or rejects an email waiting for review. An agent can’t make the program do anything; it can only ask. To run downloads on a timetable, use the Schedule tab.

The Mail Attachment Downloader main window with Connect and Download and the Downloads tab listing invoices and purchase orders from ap@contoso.example, each Saved 1 file
Downloads still start here or on the schedule: agents only look.

How the MCP server is protected

  • Local only: it listens on 127.0.0.1, so nothing on the network can reach it, and web pages in a browser can’t call it.
  • A token: a long random token, kept encrypted for your Windows user, never in the settings or the logs. New token… replaces it at once.
  • Careful with what agents send: an agent’s questions are treated as untrusted, and answers are limited in size.
  • Off means off: when it is off, nothing listens.

Microsoft Copilot Studio and Microsoft 365 Copilot

Copilot Studio agents and Microsoft 365 Copilot run in Microsoft’s cloud, so they can’t reach an address on your own system. To use one, you have to make the address reachable from the internet yourself, such as with a Microsoft dev tunnel or a reverse proxy you control, then add it in Copilot Studio as an MCP server with the token as its key. Think it over first: whoever has the token and can reach the address can read what you allowed. Using it with Microsoft 365 Copilot and Copilot Studio… in the window explains it.

Questions people ask

Can the agent start a download or change a rule?

No. It can only read. To change a rule with AI, use the AI Assistant in the program.

Can GitHub Copilot read my email?

Not the text of your emails or the files. It sees file names, times and statuses, and senders and subjects if you allow it.

Does it work in the free edition?

No. AI agents need a PRO edition, from PRO Backup up.

Does it work when the Windows service downloads?

Yes, while the program’s window is open: it reads the service’s History too. The service itself doesn’t run the MCP server.

Try it: download Mail Attachment Downloader and start with the free edition, or compare the PRO editions, each with a 30-day money-back guarantee.

Related

Questions about this post? Contact us.

Extract data from emails and integrate your business systems

Pick emails and files, read the values in them and pass them to your other systems, on a schedule or 24×7 as a Windows service.

This post shows how to extract data from emails, automate the work that follows and cut out repetitive tasks. It also gives an overview of how to connect your line-of-business systems with Mail Attachment Downloader 4.0.

Note: this is a high-level overview. For a step-by-step look at rules, see PRO Rules and moving from account settings to PRO Rules.

Automate email with attachments

What options do you have?

Mail Attachment Downloader PRO is a cost-effective way to automate email in your business. It runs on your own system, on a PC, a server or a cloud VM, and reads your mail server directly, with no cloud service in between.

The work is done by rules. Set up as many as you need, for one account or for all of them at once. In 4.0, rules live in the PRO Rules tab, the new name of 3.x’s Global filters. Each edition adds to the one before: PRO Backup, PRO Parser, PRO Rules Client and PRO Rules Server. See which edition fits.

The PRO Rules tab with a shared filter for supplier invoices, rules under it, and rules that convert, OCR and send orders on
The PRO Rules tab: each rule has its own conditions, save folder and steps.

Scheduled processing

Every PRO edition can download on a schedule from Schedule › App schedule, and pick up new mail as it arrives.

With PRO Rules Server, the same work runs 24×7 as a Windows service, installed from Schedule › Service schedule. It keeps running when nobody is signed in, and starts again by itself after a restart (Auto start on bootup). It runs on Windows Server or Windows 10 and later, so on a PC, a server or a cloud VM in Azure, AWS and others. See the PRO Rules Server how-to.

Schedule › Service schedule before the service is installed, with Install the service for, Check every and Auto start on bootup
Schedule › Service schedule: pick the account, how often to check, and click Install service.

Order of rules

Rules run from the top of the list down. Each email or file goes to the first rule that takes it. Rule settings › Check rule order… finds rules that can never save anything because a rule above takes their files. Test all rules… tries your rules on real emails without moving, deleting or sending anything.

The parts of a rule

A 3.x rule had four phases: search, extract, save and process. In 4.0 you build a rule in the Rule Editor, and the same ideas are its sections:

  • Which emails: the conditions, such as sender, subject, dates, attachment name, account or folder, with AND / OR groups.
  • Fields to find: values read from the email, such as an order number, for file names and steps.
  • Save: the attachments, the email or both, where, and how files are named. A network share works too (use a UNC path such as \\server\share).
  • Then: the steps that run after saving, in order. Steps can hold other steps: unzip a file, convert what is inside to PDF, then save its details to a database.
  • If something fails: what runs when a step fails, such as alerting your team.
The Rule Editor with Which emails, Fields to find, Save, Then and If something fails, and steps nested under Find fields with AI
The Rule Editor: steps under Then run in order, and nested steps work on the result of the step above them.

Prefer to describe it? On the AI Assistant tab, say in plain words which emails to take and what to do, and the AI builds the rule. The built-in AI runs on your own system; a cloud AI is used only once you choose it.

Multiple accounts and other sources

To limit a rule to one account, add an Account condition under Which emails. Rules also run on watches (PRO Rules Client and up): new files in folders, network shares, SharePoint, OneDrive or S3, and completed DocuSign envelopes. PRO Rules Server adds database tables, Slack and Teams. See Watches.

Integrate with your other systems

Steps under Then hand files and values to the systems you already use: Upload to cloud and Send to document management (Laserfiche, M-Files, DocuWare) from PRO Rules Client, and Save to a database, Web hook, Send to Zapier and Run a script in PRO Rules Server. For processing in your own code, a plugin API takes your own C# step. Contact us for more.

Common uses

Conclusion

Mail Attachment Downloader 4.0 PRO automates the data in your email on your own system: a PC, a server or a cloud VM. Rules pick the emails and files, read the values, save them your way and hand them on, and PRO Rules Server keeps it running 24×7.

Have a use case that isn’t covered, or need help connecting your back-end systems? Let us know.

Try it: download Mail Attachment Downloader and start with the free edition, or compare the PRO editions, each with a 30-day money-back guarantee.

Related

Using version 3.x? See the 3.x version of this guide.

Email actions: unzip an attachment, convert to PDF, decrypt a PDF and run a script

Unzip email attachments, convert or decrypt each file as PDF, then run a script on the result: steps inside steps in Mail Attachment Downloader.

This post shows how to set up a rule that unzips an email attachment, converts each file inside to PDF (or removes a PDF’s password), and then runs a script on the result. It is written for version 4.0.

Which edition you need:

You start from a rule with its conditions and its Save part set up, for example for the emails from acme.example, saved to \\fileserver\Finance\Invoices. New to rules? See save emails and attachments to folders.

Steps work on the saved files. To run them on the email itself too, set What to save to The email and its attachments: the email is then saved as an .eml file, and Convert documents can turn it into a PDF.

1. Unzip the attachment

In the Rule Editor, click Add a step…, find Unzip (type “zip” in the search box) and click Add. It goes under Then. Its options:

  • Only these files: one file name or extension per line, such as .docx and .pdf. Leave it empty to unzip every file.
  • Delete the zip file after unzipping it, if you only want the files inside.
  • Keep the folders inside the zip, to keep the zip’s own folders.
The Rule Editor with an Unzip step under Then, and its options: Delete the zip file after unzipping it, Only these files and Keep the folders inside the zip
The Unzip step and its options.

2. Convert each unzipped file, inside Unzip

Steps inside the Unzip step run for each file it unzips. To add one there:

  1. Select Unzip in the rule’s outline.
  2. Click Add a step… and, in the Add it: box, choose Inside “Unzip”.
  3. Pick Convert documents and click Add.

In the Convert documents step, click Add… to add a conversion. In the Conversion window, choose what is converted in From:, choose pdf in To:, and set the result’s name in Save as:, such as {SAVE_PATH}\{FILENAME}.pdf. Add one conversion for each kind of file, for example Word files and pictures. Tick Delete the originals after converting them if you only want the PDFs.

The Conversion window: From, To pdf, Save as with fields, Run the rules on the result, Convert with Free libraries, and the options for pictures and for the PDF made
The Conversion window of the Convert documents step.

Decrypt a PDF

Do the files arrive as password-protected PDFs? Add a conversion from PDF to pdf, with a new name in Save as: such as {SAVE_PATH}\{FILENAME}_open.pdf. Under A PDF converted, type the password in Decryption password:. The PDF it saves has no password. Remove the restrictions also drops limits such as no printing or no copying. It works the other way too: Encrypt the PDF, under The PDF made, adds a password to the PDFs you make.

The Conversion window: from PDF to pdf, saved as the file name with _open, and under A PDF converted a masked Decryption password
A PDF converted: the password opens a protected PDF, and the copy is saved without it.

3. Run a script on the converted file, inside Convert documents

Now select Convert documents, click Add a step…, choose Inside “Convert documents” in the Add it: box, and pick a step from Programs:

  • Run a script runs a script with the fields and waits for it to finish. Set the Program: (a .bat or .exe file, or powershell.exe for a PowerShell script), its Arguments: and a Timeout (seconds):. What it prints goes to the program’s logs.
  • Run a command line runs a program or a .bat file with the fields: set the Command: and its Arguments:.

Click Fields… to add fields to the arguments. Inside Convert documents, {SAVE_PATH} and {FILENAMEEXT} are the converted PDF, not the zip or the file it was made from. For example, with powershell.exe as the program, the arguments could be -File "C:\Scripts\ArchiveInvoice.ps1" "{SAVE_PATH}\{FILENAMEEXT}" "{EMAIL_FROM}".

Run: says whether the step runs For each saved file or Once per email. Click Run it once (test) to try it with a sample email’s values.

The Run a command line step: Command C:\Tools\ArchiveInvoice.exe, Arguments with the SUPPLIER, SAVE_PATH and FILENAMEEXT fields, Run For each saved file, and Run it once (test)
A Run a command line step, with fields in its arguments.

The finished rule

The rule’s outline now reads:

  • Then
    • Unzip
      • Convert documents
        • Run a script

Each zip is unzipped, each file inside is converted to PDF, and the script runs once for each PDF.

The Rule Editor of the rule Acme invoice zips: under Then, Unzip, with Convert documents inside it and Run a script inside that, running powershell.exe with -File and the saved file
Steps inside steps: Unzip, then Convert documents on each file, then Run a script on each PDF.

Click Test this rule… to try it on emails you pick. Unzipping and converting are done for real, into a temporary folder, so you can open the PDFs. The script is only described, not run. Then click Save.

A step can fail, for example when a PDF’s password is wrong. Steps under If something fails, such as Move or copy the email or Send notification, tell you or set the email aside. The program also tries a failed step again by itself. See nesting email rules and actions.

More steps for files

Other steps go well with these: Convert all files to a single PDF, Merge PDFs, Split PDF and Make PDFs searchable (OCR) (PRO Rules Server), and Upload to cloud or Copy file (PRO Rules Client and up). Need a step that isn’t there? Contact us and we’ll look at it.

Try it: download Mail Attachment Downloader and start with the free edition, or compare the PRO editions, each with a 30-day money-back guarantee.

Related