I built an AI email agent, then attacked it with hand-written **prompt injection** emails before trusting it with my real inbox.
All six attacks that actually reached the agent were flagged correctly — including a base64-encoded payload and two impersonation attempts. That is not a benchmark, and 6/6 does not mean a 100% detection rate; it means these six attacks did not fool this version of the system.
The one innocent control that reached judgment — a genuine `.gitignore` question that used the word "ignore" on purpose — was drafted normally and sent. The second control never arrived: a filename collision ate it first, after a silent `launchd` hang had already stopped the fetcher.
I am one week away from a proper holiday, the kind where I do not check email at all. So this week I have been working with Claude to build something to cover for me: an agent that reads the messages landing in my inbox and my “Ask Elena” form, works out whether they deserve a reply, and drafts one in my voice while I am away.
Halfway through building it, I stopped typing and just looked at what I had made. This agent reads text written by literally anyone who can find my contact form. It hands that text to a large language model. That model can write files to my computer, and in one pipeline it can look up which of my own blog posts to cite. I had built a door, and I had propped it open, and I was about to leave the country.
So before I let this thing anywhere near a stranger’s email, I decided to become the stranger first.
The Experiment: Thirteen Messages, Three Questions
I gave the defence thirteen messages: eleven attacks and two innocent controls. I wanted to know three things:
Would malicious instructions be detected?
Would innocent messages still get through?
Would every message actually reach the defence?
That third question became wonderfully important later.
Still in this guide
Trust Boundary: Where Instructions Are Allowed to Come From
The Attack Suite I Wrote Against Myself
Nothing Happened: Then I Found Two Ordinary Bugs
What the Defence Actually Saw: Six Attacks, Six Flags
Detection Is Not Containment
Defence in Depth
What This Experiment Did Not Prove
Checklist: Defending an AI Agent Against Prompt Injection
Key Takeaway: Build Systems That Stay Safe When Parts Are Wrong
References
You've hit a Deep Dive tutorial.
I spend dozens of hours researching, coding, and breaking things to write these guides. This content is free, but reserved for my subscriber community. Drop your email below to unlock this guide (and all past/future deep dives):
Full content temporarily unavailable — refresh in a moment
You're in
I'll send weekly notes on AI tools, Python, and what I'm actually building. Check your inbox for Set a password to unlock articles — the form does not log you in.
New subscribers get an inbox mail: Set a password to unlock articles. The form does not log you in — use the same email afterwards.
References
About Elena
Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.
Citation
Elena Daehnhardt. (2026) 'I Gave My AI Agent the Keys to My Inbox — Then Tried to Break Into It Myself', daehnhardt.com, 24 August 2026. Available at: https://daehnhardt.com/blog/2026/08/24/i-gave-my-ai-agent-the-keys-to-my-inbox/
I'll send weekly notes on AI tools, Python, and what I'm actually building. Check your inbox for Set a password to unlock articles — the form does not log you in.