Mail Attachment DownloaderVersion 4.0Version 3.xNo 3.x guide for this. All 3.x guides

Send emails and invoices to your CRM or ERP: Dynamics 365, Business Central, Salesforce and HubSpot

Send emails, attachments and invoice data to Dynamics 365, Business Central, Salesforce or HubSpot: leads, cases and draft invoices, never twice.

Send to CRM or ERP set to Attach to the record it finds in Contoso Sales (Dynamics 365): a Contact found by emailaddress1, the saved files attached, Put the email on its timeline ticked, and Give a warning if no record matches

Customer emails that never reach the CRM, enquiries someone has to type in, supplier invoices keyed into the ERP by hand: Mail Attachment Downloader can do that work for you. A rule or a parser picks the emails and sends each one to Dynamics 365, Business Central, Salesforce or HubSpot: as a new lead, contact or case, as a draft purchase invoice with its lines, or filed on the record it belongs to, with its attachments. It finds the record first, so the same email never makes a second one. Rules can also look a vendor up by the VAT ID on an invoice, or check that its purchase order is open before anything is made. And it works the other way: an invoice posted or a deal won in the system can start your rules.

It runs on your own system (a PC, a server or a cloud VM), and nothing goes to the CRM or ERP until a rule, a parser or a watch you made uses the connection. New in version 4.0. The examples use Contoso’s mailboxes sales@contoso.com and ap@contoso.com, invoices from Acme and Fabrikam, and invoice numbers like INV-2026-0423.

Which CRM and ERP systems?

  • Dynamics 365: the Sales, Customer Service and other apps on Dataverse.
  • Business Central: Business Central online, in any environment and company you can reach. Not Business Central on-premises.
  • Salesforce: the editions with API access: Enterprise, Unlimited and Developer, and Professional with Salesforce’s API add-on.
  • HubSpot: signs in with a service key.

There is no connection for NetSuite, SAP Business One, Odoo, Zoho, Sage, Xero or QuickBooks. For those, a rule can add the values to a spreadsheet or a CSV file to import, or call the system’s API with a web hook or Zapier (PRO Rules Server).

Which edition do you need?

  • PRO Parser: the CRM and ERP connections, the Parser’s CRM or ERP output (a draft purchase invoice for each supplier invoice, a lead for each enquiry), and adding the people in your mailbox to the CRM’s contacts.
  • PRO Rules Client adds the Send to CRM or ERP and Look up in CRM or ERP steps for any rule, the Parser’s checks against the system, the Sender is new condition and CRM or ERP watches.
  • PRO Rules Server adds the Windows service, which runs all of it around the clock with no one signed in.

Step 1: Connect your CRM or ERP

Open Settings › Sources › CRM and ERP, click Add… and pick the system. Each connection is signed in once and gets a name; rules, parsers and watches pick it by that name, and its keys stay encrypted on this computer.

  • Dynamics 365 and Business Central: Sign in with a Microsoft 365 work account, the way Microsoft 365 email accounts sign in. The first sign-in in a company may ask an administrator to allow it once. For Business Central, List then finds the Environment and the Company.
  • Salesforce: your organization’s External Client App, with its My Domain address, consumer key and consumer secret. The user it signs in as needs the API Enabled permission.
  • HubSpot: a service key from your HubSpot account.

Click Test, then OK. The window says exactly what leaves this computer, and nothing is sent until a rule, a parser or a watch uses the connection.

Settings, Sources, CRM and ERP in Mail Attachment Downloader: four connections, Contoso Business Central, Contoso Sales in Dynamics 365, Contoso Salesforce and Contoso HubSpot, with where each reaches and what it signs in as
Settings › Sources › CRM and ERP: one connection for each system, signed in once.
The Business Central connection window: Sign in with Microsoft 365 work account, signed in as ap@contoso.com, the Production environment, the company Contoso Ltd., and what leaves this computer
A Business Central connection: a Microsoft 365 work account, the environment and the company.

Step 2: Make a contact, lead or case from each email

  1. On the PRO Rules tab, click New rule… and, under Which emails, pick the emails: an Account such as sales@contoso.com, your customers’ domains, or Sender is new for the first email from an address you have never had mail from. It counts from the day you add it, so older mail doesn’t make everyone new.
  2. Under Then, click Add a step…, open Other systems and double-click Send to CRM or ERP.
  3. Choose Make a record, the Connection, and what to Make: a contact, a lead, a case… List reads the kinds of record the system has.
  4. Under Find it first by, tick the fields that tell records apart, such as the email address. A record with those values is the one this email updates, whoever made it, so a contact already in the CRM is updated, not added twice.
  5. Click Mapping… to fill the record’s fields (next section), and under Attach, tick The saved files, The email itself (.eml), or both.
A rule for info@contoso.com with the Sender is new condition and a Send to CRM or ERP step that makes a contact in Contoso HubSpot, found first by its email address, with 3 fields filled
Sender is new, then a HubSpot contact, found first by its email address.

The files go where each system keeps them: notes in Dynamics 365 and HubSpot, attachments in Business Central, Salesforce Files in Salesforce. Test signs in, reads the fields and checks the mapping; it makes nothing.

Fill the fields from the email and what was read from it

Mapping… lists the record’s fields as the system describes them, with the required ones marked *. Each field takes one of these:

  • Rule fields: the email’s details, such as {EMAIL_FROM}, {SUBJECT} or {DATE[yyyy-MM-dd]}.
  • A value read from the email: a phone number or a company from a web form or a signature, found by the Parser or a Find fields with AI step.
  • Fixed text: the same value each time, such as a lead source.
  • A value looked up in the system: such as the vendor’s number, found by the VAT ID on an invoice.

A required field that would be empty fails the send with a clear reason, before anything is made.

The same email again, and a person’s changes

If the email comes again, for example after a Redo on the Downloads tab, the step updates the record it made, by default: the fields, the lines and the files that changed. It can also Leave it as it is or Make another. When the system already has a record with those Find it first by values that this email didn’t make, If a match is there decides: Update it, Leave it as it is or Fail the step.

A person’s work comes first. A record someone changed in the system since it was sent, or a document already posted, is left as it is, and Downloads and History show a warning.

Step 3: File customer emails on the record they belong to

To keep each customer’s emails in the CRM without making new records, choose Attach to the record it finds instead. Attach to says what kind of record, such as Contact, and Find it first by how to find it: the contact by the sender’s address, or a case by the case number read from the subject.

  • Dynamics 365: tick Put the email on its timeline, with its files. The email shows among the record’s activities, so the whole team sees the conversation.
  • Business Central, Salesforce and HubSpot: the saved files are attached to the record.
  • If no record matches, Give a warning attaches nothing and lets the step succeed, with a warning in Downloads and History; Fail the step stops it.

The same email again adds nothing.

Send to CRM or ERP set to Attach to the record it finds in Contoso Sales (Dynamics 365): a Contact found by emailaddress1, the saved files attached, Put the email on its timeline ticked, and Give a warning if no record matches
Attach to the record it finds: the sender’s contact in Dynamics 365, with the email on its timeline.

Step 4: Send supplier invoices to Business Central as drafts

For invoices, start with the Parser. It reads the invoice number, the dates, the VAT ID, the purchase order number, the total and the table of lines from each supplier’s invoice: highlight a value once, describe it in words for AI field extraction, alone or with patterns, or let it read e-invoices such as Factur-X, XRechnung and Peppol exactly from their data. Then, in the parser’s Output step, switch on CRM or ERP:

  • Make: a purchase invoice, as a draft.
  • Fields: the vendor, the vendor’s invoice number, the invoice date and the due date. The mapping can look the vendor up in Business Central by the VAT ID on the invoice, else by the sender’s address.
  • Lines: each row of the invoice’s table becomes a line, with its description, quantity and unit cost from the table’s columns, and a fixed line type and G/L account if you like.
  • Find it first by: the vendor number and the vendor’s invoice number, so the same invoice updates its draft instead of making a second one.
  • Attach: the saved PDF, and the email itself if you like.
The Parser's CRM or ERP output for Contoso Business Central: a purchase invoice made as a draft, 4 fields filled and 1 looked up, the lines from the table Lines, found first by vendorNumber and vendorInvoiceNumber, the saved files attached, and the list of what it sends
The Parser’s CRM or ERP output: a draft purchase invoice with its lines, the vendor looked up.

Lines… maps a line the way Mapping… maps the fields, from the columns of the invoice’s table. Processing the email again replaces the lines it made; the lines of a record it didn’t make stay as a person made them. Lines work for Business Central purchase invoices and orders, and for HubSpot deals.

The Lines tab of the mapping window for a Business Central purchase invoice: lineType and lineObjectNumber as fixed text (Account and 61100), and description, quantity and directUnitCost from the table columns Description, Qty and Unit
Each row of the invoice’s table becomes a purchase invoice line.

Before the first send, it asks, naming the fields, lines, files and looked-up values it sends. Business Central keeps the documents as drafts: your team checks and posts them, as they do today. With PRO Parser, this is all you need; with PRO Rules Client, the same send is also a step any rule can use. More in supplier invoices into Business Central.

Check invoices against Business Central first

With PRO Rules Client, the parser’s Checks step can ask the system too, under In a CRM or ERP system. Is the purchase order the invoice names in Business Central, with the status Open? Is its total the invoice’s total, within 0.01? An invoice that fails waits in Needs you, with the system’s answer as the reason, and no draft is made. These checks run when the rule runs, not on the parser’s samples.

The Parser's checks In a CRM or ERP system: in Contoso Business Central, the purchaseOrders record whose number is po_number must have the status Open, and its total must match the invoice's total within 0.01
Checks in Business Central: the purchase order is there and open, and its total matches.

Look up a record for folders, file names and later steps

Look up in CRM or ERP (Add a step… › Other systems) finds one record and fills rule fields from it. It only reads. For a supplier invoice, it can find the vendor whose taxRegistrationNumber is {VAT_ID}, else whose email is {EMAIL_FROM}, and fill VENDOR_NUMBER and VENDOR_NAME from its number and name. Save the PDF to \\fileserver\Finance\Invoices\{VENDOR_NAME}, name it {VENDOR_NUMBER} {INVOICE_NUMBER}.pdf, or use the fields in a condition.

  • If none is found: Leave the fields empty, or fail the step.
  • If several are found: fail the step, or take the first.

Only the values it searches for leave your computer, and the step says so.

The Look up in CRM or ERP step: in Contoso Business Central, find a Vendor whose taxRegistrationNumber is {VAT_ID}, else whose email is {EMAIL_FROM}, and fill VENDOR_NUMBER and VENDOR_NAME from its number and displayName
Look up in CRM or ERP: the vendor by its VAT ID, for the folder, the file name and later steps.

Start rules from the CRM or ERP: watches

A CRM or ERP watch works the other way round: records that reach a state in the system go through your rules like emails, with their files. Click Add account › Watch a CRM or ERP, pick the connection and the Records:

  • Business Central: invoices and credit memos once posted, quotes once accepted.
  • Dynamics 365: opportunities and quotes once won, cases once resolved, leads once qualified, orders once fulfilled, invoices once paid.
  • Salesforce: opportunities once won, cases once closed, leads once converted, quotes once accepted, orders and contracts once activated.
  • HubSpot: deals once won, tickets once closed.

Or any kind of record, new or changed. Each record brings its attached files, and in Business Central the PDF it makes of the record, with its fields as {CRM_...} fields for folders, file names and conditions. Save each posted invoice to a share, SharePoint or S3, or your document management system, named your way. In Dynamics 365 and Business Central, New files attached to records takes each new file attached to any record instead.

The watch checks about every 60 seconds and only asks the system for records and their files. Records changed before you save it are left alone, unless you tick Also take the records already there. More in watch a folder and process files automatically.

New watch, CRM or ERP: records and their files, on Contoso Business Central: Records that reach a state, Sales invoices, once posted, each bringing the PDF Business Central makes of it and the files attached to it, checked every 60 seconds
A CRM or ERP watch: Business Central sales invoices once posted, each with its PDF.

Add the people already in your mailbox

Years of email hold your customers, suppliers and partners. With PRO Parser, the Backup tab’s Extract data lists the people in a mailbox’s backup, each once, with job titles, phone numbers and companies from their signatures, and leaves out mailing lists, bounced addresses, Junk and your opt-outs. Also add them to a CRM adds new people to its contacts; people already there only get the details missing there, so nothing a person typed is changed. It asks first. See contact lists from email.

Keep the CRM current around the clock

To keep it running while nobody is signed in, run the program as the Windows service of PRO Rules Server. Dynamics 365 and Business Central then sign in with your own app registration in Microsoft Entra ID (App registration with a client secret); for Business Central, add it on Business Central’s Microsoft Entra Applications page. Salesforce and HubSpot sign in as they do in the app.

Questions people ask

Does it post invoices in Business Central?

No. Purchase invoices, orders and other documents are only ever made as drafts. A person checks and posts them.

Will it make duplicate contacts, leads or invoices?

No. It finds the record first: by its own note of what it made, then by the Find it first by fields. A Redo, or the same email processed again, updates that record. Each account’s History also remembers the emails it has handled, so a normal run doesn’t send an email twice.

What leaves my computer?

Only the fields and lines you map, the files you attach and the values a look-up searches for, sent to the system you picked, when a rule, a parser or a watch uses the connection. If you choose a cloud AI to read invoices, it gets the email’s text and files only after you pick it and say yes; the built-in AI keeps everything on your computer.

Is it priced per record or per invoice?

No. Each PRO edition is one price per computer, for any number of emails, records and invoices. A cloud AI you choose bills you for its own use; the built-in AI and patterns cost nothing more.

Why rules, and not just an AI agent?

An AI asked about each email spends tokens on the same job again and again, and can’t promise it won’t make a record twice. Here the AI reads only what a pattern can’t, its answers can become patterns, and the rule decides what goes where, the same way each time. See why rules and AI.

Related

Questions about this post? Contact us.