Skip to main content

GAM: Phishing Email IR

GAM is a powerful tool but with great power comes great responsibility. Some commands can cause irreversible changes if used incorrectly, so always test and proceed with caution.

GAM Documentation and Installation Instructions: https://github.com/GAM-team/GAM/wiki


GAM Commands

Query User Inbox for a Specific Message

You can locate a specific email by Message-ID or by Subject line.

gam user <user email> show messages query "rfc822msgid:<message ID>"

Or:

gam user <user email> messages query "subject:<Email Subject>"

Delete a Single Email

To delete an email (after exporting for safety), use:

gam user <user email> export messages query "rfc822msgid:<message ID>" targetfolder <folder path>

Delete a Single Email From Multiple Accounts

If you need to remove a message across many accounts, use a CSV list of users.

By Message-ID:

gam csv "users.txt" gam user "~<file header name>" delete messages query "rfc822msgid:<message id>" doit

Or by Subject line:

gam csv "users.txt" gam user "~<file header name>" delete messages query "subject:<subject line>" doit

Export Email for Analysis

If you need to capture a message before deletion:

gam user <user email> export messages query "rfc822msgid:<message ID>" targetfolder <folder path>

Final Thoughts

These commands are extremely helpful when cleaning up mailboxes or transferring files, but mistakes can result in permanent data loss. Always:

  • Test with non-critical accounts first

  • Double-check IDs, subjects, and emails

  • Consider exporting data before deletion

Comments

Popular posts from this blog

Why Securing Things “Backwards” Is So Difficult in K–12 IT

Many K–12 districts are facing a difficult reality: after years of convenience-first technology use, the time has come to adopt a more secure, structured approach. Cyber insurance requirements are tightening. State and federal regulations are growing. Threats are increasing. And school systems are expected to modernize their security posture quickly and without disrupting learning. But strengthening security in a district that has operated with wide-open access for years isn’t just a technical challenge; it’s a cultural renovation. Transitioning from “anything goes” to “secured by design” is one of the hardest shifts for schools to make. Not because people don’t care about security, but because securing things backwards means undoing years of habits, expectations, and legacy decisions. Here’s why it’s so difficult , and how districts can make the transition without breaking what’s working. Why Securing Things Backwards Is Hard 1. You’re Taking Away What People Are Used To When classr...

Vendor and Third-Party Risk Management in K–12: Protecting Student Data Beyond Your Walls

Modern school districts rely on hundreds of third-party applications, ranging from learning management systems and browser extensions to assessment platforms and parent communication tools. Each of these vendors connects to your network, accesses your data, or processes sensitive student information. Every one of them represents potential risk. While internal defenses like patching, MFA, and backups are essential, vendor risk management ensures your district is protected from vulnerabilities that originate outside your network . Why Vendor Risk Management Matters for Schools School technology ecosystems have expanded rapidly over the last decade. What used to be a handful of software systems is now a web of cloud tools, integrations, and data sharing agreements. Without strong oversight, this complexity creates real-world risk: Data Breaches via EdTech Vendors: Many school breaches occur not from internal attacks, but through compromised third-party systems. Privacy Compliance Exp...

Incident Response for Schools: Why Playbooks Matter

When a cybersecurity incident occurs, such as a phishing email, ransomware outbreak, or accidental exposure of student data, the first few minutes are crucial. Yet, many school districts lack a clear, step-by-step plan for responding. The result? Confusion, delayed decisions, extended downtime, and even compliance failures. That’s why every school should have Incident Response (IR) playbooks : simple, one-page guides that outline who to call, what to do, and how to contain and recover from common incidents. Why Playbooks Are Critical in Schools Clarity Under Pressure: When panic sets in, playbooks provide structure. Staff know exactly what steps to take. Consistency: Every incident is handled the same way, reducing the risk of mistakes. Compliance: For Kansas schools, ITEC 7230a requires incident response planning and documentation. Playbooks help districts meet that standard. Framework Alignment: The NIST Cybersecurity Framework (CSF) 2.0 emphasizes Respond as o...