Applies to Aiwyn Payments firms that email invoices from their practice management system through their own mail server (Microsoft 365 or Google Workspace). CCH Axcess firms do not use a mail rule.
Use this guide to create the mail rule that redirects your firm's outgoing invoice emails to Aiwyn. The rule watches for a specific subject line, sends any matching message to your firm's Aiwyn inbound email address instead of the client, and keeps the attachments and original recipients intact. Aiwyn then sends the client the Aiwyn invoice email with the Pay invoice button. Anything that doesn't match the rule leaves your firm as an ordinary email.
This is a firm IT task. Aiwyn cannot create the rule for you because it lives in your mail tenant, and Aiwyn Support cannot see it.
When to create the rule
Create the rule live during your first Testing Session, with your Aiwyn Implementation Specialist on the call. Your IT administrator needs to be on the call for only the first part of the session and can leave once the rule is verified.
If your IT team prefers to build the rule ahead of time, create it but leave it disabled. At the start of the Testing Session, show the rule to your Implementation Specialist, enable it together, and test it. Rules that were built and enabled before testing have caused problems in the past, so don't turn the rule on without Aiwyn on the call.
Once the rule has been tested, leave it on. The criteria are specific enough that no live client email is caught by accident, and leaving it on means Aiwyn and your firm can test at any time without asking IT to switch it on and off.
Before you begin
You need three things from your Implementation Specialist. They are confirmed on the Testing Session call, which is why the rule isn't built earlier:
- Your Aiwyn inbound email address, in the form
yourfirm@inbound.aiwyn.ai. It is unique to your firm and your exact Aiwyn inbound email address is provided to you by your Implementation Specialist. Enter it exactly as provided, all lowercase, with no spaces. - The subject line text the rule matches on. For almost every firm this is
Invoice_Aiwyn, with a capital I and a capital A. The match is case-sensitive. - The exception words
RE,FWandFWD, so replies and forwards that happen to contain the subject line are not redirected.
You also need an administrator who can sign in to the Microsoft 365 Exchange admin center (or the Google Admin console) and create mail flow rules and mail contacts.
Before the call, confirm one thing about your practice management system: invoice emails must actually pass through your mail server. Some systems can send through their own SMTP service instead. If a hosted system (Practice Engine, for example) is sending through its vendor's SMTP relay, your rule never sees the message. Ask the vendor to point the system's outgoing mail at your Exchange or Google tenant, or talk to your Implementation Specialist about the direct-send route instead.
Finally, know what else sits in your outbound mail path. Filtering services such as Mimecast or Proofpoint must not intercept these messages before the Aiwyn rule runs.
Microsoft 365 (Exchange Online)
Step 1: Create a mail contact for the Aiwyn inbound address
The mail flow rule redirects to a recipient, so the Aiwyn address must exist as a contact first.
- Sign in to the Exchange admin center.
- In the left pane select Recipients, then Contacts.
- Select Add a mail contact.
- Enter First name
Aiwynand Last nameRedirect. The display name becomes Aiwyn Redirect. The alias cannot contain a space. - In External email address, enter your Aiwyn inbound address exactly as provided, for example
yourfirm@inbound.aiwyn.ai. Leave the other fields empty. - Select Next, then Create. Wait for the confirmation banner before you continue.
Step 2: Create the mail flow rule
- In the left pane select Mail flow, then Rules.
- Select Add a rule, then Create a new rule.
- Name the rule Aiwyn Redirect.
- Under Apply this rule if, choose The subject or body, then subject matches these text patterns. Enter the subject line text from your Implementation Specialist, normally
Invoice_Aiwyn, select Add, then Save. - Under Do the following, choose Redirect the message to, then these recipients. Select the Aiwyn Redirect contact you created in Step 1.
- Under Except if, choose The subject or body, then subject includes any of these words. Enter
RE,FWandFWD, selecting Add after each, then Save. - Select Next.
Step 3: Set the rule options
On the Set rule settings page:
- Set Rule mode to Enforce. Do not use either test mode.
- Select Stop processing more rules.
- Set Priority to 0 so this rule runs before every other rule in your tenant. If another rule already holds priority 0 (a Proofpoint or Mimecast routing rule, for example), it moves to priority 1. These invoice emails need to reach Aiwyn directly and should not be processed by your filtering service first.
- Select Next, review the summary, then Finish. Wait for the save to complete.
If you created the rule before setting these options, open it from the rule list, select Edit rule settings, make the same three changes, and save.
Step 4: Enable the rule
New rules are created disabled. In the rule list, select the Aiwyn Redirect rule and turn on the Enable or disable rule toggle. Wait for the green confirmation banner.
Do this step with your Implementation Specialist on the call. If you are building the rule ahead of the Testing Session, stop before this step.
Take a screenshot of the finished rule and send it to your Implementation Specialist for your firm's implementation record.
Google Workspace
In Google Workspace, the equivalent of a mail flow rule is a Gmail Content compliance setting that changes the envelope recipient of matching outbound messages.
- Sign in to the Google Admin console.
- Go to Apps, then Google Workspace, then Gmail, then Compliance.
- On the Content compliance row, select Configure and give the setting a name such as Aiwyn Redirect.
- Under Email messages to affect, select Outbound.
- Under Add expressions that describe the content you want to search for in each message, choose If ALL of the following match the message. Add an Advanced content match with Location set to Subject, Match type set to Contains text, and Content set to your subject line text, normally
Invoice_Aiwyn. - Add further Advanced content match expressions on Subject so that messages whose subject contains
RE:,FW:orFWD:are excluded, so replies and forwards aren't redirected. - Under If the above expressions match, do the following, keep Modify message and, under Envelope recipient, select Change envelope recipient and enter your Aiwyn inbound address.
- Save the setting and confirm it with your Implementation Specialist before any invoice is sent.
Test the rule with your Implementation Specialist
Testing takes a few minutes and uses a test invoice from your practice management system.
- A member of your billing team emails a posted test invoice from your practice management system with a small non-zero balance. For a one-off test, use the system's manual send so the subject and recipient can be edited, rather than the automated e-bill queue.
- Replace the subject line with the exact text in your rule, normally
Invoice_Aiwyn, and address the email to yourself or a colleague at the firm, never to a real client. - Confirm the PDF file name contains your invoice delimiter and the invoice number (for example
Invoice_12345.pdf). Aiwyn uses the file name to match the email to the invoice. - Send the email.
The rule is working when the original email never arrives in the recipient's inbox and your Implementation Specialist confirms the message reached Aiwyn's inbound address. If the recipient receives the plain practice-management version of the email, the rule didn't catch it.
Shortly afterwards the recipient receives the Aiwyn invoice email, with your firm's logo and a Pay invoice button, and the invoice number turns teal on the Invoices tab of the Firm Portal. If the rule caught the email but the Aiwyn invoice email doesn't arrive, that is a separate issue with Aiwyn's configuration or your spam filtering, not the mail rule.
Don't resend the same test invoice within 20 minutes. Aiwyn discards a second email for the same invoice inside that window.
If the test fails
| What you see | Likely cause | What to check |
|---|---|---|
| The recipient received the plain email from your practice management system | The rule didn't match or didn't run | The subject line is identical to the rule, including capitals and the underscore. The rule is enabled and in Enforce mode. No higher-priority rule or filtering service handled the message first. |
| The message doesn't appear in your Exchange message trace at all | Invoice emails aren't passing through your mail server | Ask your practice management vendor whether the system sends through its own SMTP service and have it pointed at your tenant. |
| Aiwyn received the email but the Aiwyn invoice email never arrived | Sender domain or spam filtering | The From address uses a domain Aiwyn has set up DNS records for. Your filtering service allows Aiwyn's sender IP ranges; see Whitelist email sender IP address ranges & bypass anti-spoofing. |
| Aiwyn received the email but the invoice number isn't teal in the Firm Portal | Aiwyn couldn't match the PDF to an invoice | The invoice is posted with a balance above $0, and the PDF file name contains the delimiter and invoice number. |
After go-live
- Match the subject line at go-live. Before your first live send, the default invoice email subject in your practice management system must match the rule exactly. Your Implementation Specialist helps you decide whether to change the system's default subject line or the rule's text pattern; changing the system is usually easier because it doesn't need an IT administrator on a call.
- The rule applies to every email in your tenant. An email sent from Outlook with the matching subject is redirected to Aiwyn too, even if it wasn't an invoice.
- Turn off any auto-BCC in your practice management system. Aiwyn copies your firm on the Aiwyn invoice email instead. CC recipients you add in the system are kept.
- Keep the rule where it is. If your firm moves mail tenants or a sending mailbox moves to another organization, the rule doesn't move with it. Recreate it in the new tenant and test again with Aiwyn Support.
- Changing the rule later. If you change the subject line, the inbound address or the exceptions after go-live, tell Aiwyn Support before you make the change so the two sides stay in step.