How We Anonymise Emails Before Our AI Reads Them

Our AI fraud watch checks our company email for bank detail scams. Simple rules on our own server pick out the emails that mention money, bank details or logins, and only those go to our AI engine to be rated. That already kept most of our email away from the AI. But the emails that did go still carried the details of real people: tenants' names, suppliers' phone numbers, sort codes and account numbers. So I asked a simple question. Does the AI need to know who anyone is to spot a fraud? It does not. So now it never sees them.

Why bother

UK data protection law expects a business to use only the personal data it needs for a job. The AI's job here is to read an email and say whether it looks like fraud. It needs the wording, the sender's domain, the amounts and whether the bank details have changed. It does not need to know that the tenant is called Mrs Jones or that her account number ends in 4471. Every detail we do not send is one that cannot leak, be stored somewhere we did not expect or end up anywhere it should not.

It also makes the next conversation easier. When a tenant or supplier asks what happens to their emails, "the AI never sees your name or bank details" is a far better answer than "it is covered by the terms".

What the AI sees now

Before an email goes to the AI, our software swaps each personal detail for a token. Here is a made-up example of the kind of email the fraud watch exists to catch, before and after.

Before and after. Before: an email from Jane Halliwell at brightbuild-ltd.co.uk to Tracey saying please note our new bank details for invoice 1043, £1,250, payee Mark Ellison, sort code 01-02-03, account 12345678, call 07700 900123, Brightbuild Ltd, 1 Example Street, Anytown AB1 2CD. After: the same email with the sender shown as PERSON_1 at brightbuild-ltd.co.uk, the payee as PERSON_2, the sort code, account, phone number, street address and postcode as tokens, and the wording, invoice number, amount and company name unchanged
A made-up email as our staff would see it, and as the AI now sees it. All names and numbers in it are invented.

The AI can still see everything that makes this suspicious: a supplier saying its bank details have changed, a payee who is a different person from the sender, and a request tied to a real invoice and amount. What it cannot see is who any of these people are.

What is swapped and what is kept

Swapped for tokens:

  • names of people outside the company: the sender, anyone greeted ("Dear Jane"), and anyone named as a payee or account holder
  • email addresses outside our own domains
  • phone numbers
  • sort codes, account numbers and IBANs
  • street addresses and postcodes

Kept, on purpose:

  • The sender's domain. The address becomes [EMAIL_1]@brightbuild-ltd.co.uk, not just [EMAIL_1]. A domain one letter different from a real supplier's is one of the strongest signs of fraud, so the AI needs it.
  • Our own staff. Their names are already in the AI's instructions, and it needs to know when an email claims to come from one of us.
  • Company names, amounts, dates and the wording. These are what fraud is judged on, and they are not personal data about a private individual.

The same detail always gets the same token

This is the part that makes it work. Within one email, Jane Halliwell is always [PERSON_1], wherever her name appears, and the payee Mark Ellison is [PERSON_2]. So the AI can still see the thing that matters most: the money is going to someone other than the person asking for it. If every name became the same word, such as [NAME], that signal would be lost.

Putting the details back

Our software keeps the list of which token stands for which detail. It stays on our server and is never sent anywhere. When the AI's rating comes back, with a reason such as "[PERSON_1] asks for payment to [PERSON_2] at a new account", the software swaps the real details back in. So the reason I read on the fraud watch page, in the alert email and in the warning that pops up for staff says Jane Halliwell and Mark Ellison, as you would expect.

The AI is also told what the tokens mean: that the same token is the same detail, that a different token is a different person, and that it should judge the email as if the real details were there.

How the software finds the details

With fixed rules, not with another AI. Sending an email to one AI to remove the personal details before sending it to another AI would rather defeat the point. The rules look for the shapes of things: an email address, a UK phone number, a sort code, an eight digit account number, a postcode, a house number followed by a street name. Names are taken from the places they reliably appear: the sender's name, greetings and "Payee:" or "Account name:" lines. Names that look like a company, a bank or a team are left alone.

Did it make the fraud watch worse?

That was the real question, so we tested it before switching it on. We took 339 emails the fraud watch had already rated and rated them again, anonymised. To be fair, we also rated the same 339 again without anonymising, because an AI does not give exactly the same answer every time.

  • Anonymised, the ratings matched the originals on 327 of 339 emails, 96.5%.
  • Not anonymised, rated a second time, they matched on 330 of 339, 97.3%.
  • Both caught the fake bank change email I had sent to test the fraud watch.

So anonymising cost less than one percentage point of agreement, about the same as the difference between asking the AI once and asking it twice. We also checked every anonymised email automatically for anything that had slipped through: email addresses outside our domains, sort codes, account numbers, phone numbers and postcodes. There were none: 0% of the 339. The whole test cost under $5 of AI usage.

Your situation may be slightly different. ask a question below ↓ and our editorial team will reply with our advice.

Strictly speaking, this is pseudonymisation

I have called this anonymising because that is the word most people use. The precise term is pseudonymisation. Truly anonymous data can never be linked back to a person by anyone. Ours can, because we keep the list that turns [PERSON_1] back into Jane Halliwell. That is the whole point of the list: it lets us read the AI's reason with the right names in it.

The distinction matters in law. The ICO, the UK's data protection regulator, is clear that pseudonymised information is still personal data in the hands of anyone who holds the extra information needed to identify people, which here means us. So UK GDPR still applies to these emails in full, just as it did before. What pseudonymisation does is reduce the risk: the AI service receives far less that could identify anyone, and the key that would identify them never leaves our server. The ICO's guidance on pseudonymisation explains it well, and it is short enough to read in one sitting.

What it cannot do

  • Names in the middle of a sentence can get through. "Please tell Sarah the money is ready" contains a name our rules do not know to look for. Catching every name would need an understanding of language that fixed rules do not have.
  • Context can still identify someone. An email about "the flat above the chip shop" contains no name, but someone who knew the street might work it out. Anonymising reduces what is sent; it does not make any text impossible to trace.
  • Unusual formats may be missed. An account number written with spaces in odd places, or a foreign phone number, may not match a rule.

That is why we still treat the fraud watch as a careful reader that sees as little as it needs, not as a sealed box. It runs alongside the other things we do, which I describe in how we use AI safely in a small business.

What I would tell any small business

  • Ask what the AI actually needs. For most jobs, summarising, sorting, checking or drafting, it does not need to know who anyone is.
  • Use tokens, not blanks. Give each detail its own consistent token, so the AI can still follow who is who.
  • Keep the key at home. The list that turns tokens back into details should never leave your own system.
  • Do not treat it as a way out of data protection law. Tokens you can reverse are pseudonymisation, not anonymisation, and the data is still personal data to you. It is a way to reduce risk, not to remove your responsibilities.
  • Test it on your own real work. Compare results with and without anonymising, and compare against simply asking twice, so you know what the change really costs.
  • Check for leaks automatically. A simple search of what you are about to send, for anything that looks like an account number or email address, catches the gaps your rules missed.