Does Gmail Delete Old Emails?
On this page
Gmail does not normally delete messages from your inbox or All Mail because of their age. Gmail keeps deleted messages in Trash for 30 days, then removes them permanently. Spam is also cleared after 30 days, according to Gmail deletion guidance.
A filter or another mail app can delete messages. Someone with access to your account can delete them too. Google’s inactive-account policy applies to the account and its data, rather than deleting individual messages because of their age. To keep your own copy of email, mailmd is a free, open-source tool that saves messages as Markdown files on your computer.
What Gmail deletes automatically #
When you delete a message, it goes to Trash and stays there until you empty it or Gmail removes it after 30 days. Choosing Empty Trash now removes those messages immediately. Gmail also clears Spam after 30 days, according to SysTools’ explanation of Gmail auto-deletion.
Archiving works differently: it removes a message from the inbox but keeps it in All Mail, where it remains searchable. If an old message seems missing, search All Mail before assuming it was deleted.
Google’s inactive-account policy is a separate concern. Google announced that it could delete an account after two years without activity. Signing in counts as activity. Reading or sending email counts too. That policy applies to the account and its data, rather than deleting individual messages because they are old, as The Verge reported.
Check why a message disappeared #
Start by searching All Mail, then check Trash and Spam. If the message is in Trash, move it back before the 30-day period ends.
If messages keep going to Trash, review Gmail’s filters under Settings → See all settings → Filters and Blocked Addresses. A filter set to Delete it sends matching new messages to Trash. The option to apply a filter to matching conversations can apply it to existing messages. The filter instructions from Saint Augustine’s University explain where to review those rules.
Another mail app or an account delegate, someone you have allowed to access your Gmail, can delete messages. If you use a mail program that connects to Gmail with POP, a protocol for retrieving email, check its settings to see whether it leaves Gmail’s copy in the inbox. If the cause remains unclear, review connected third-party access, which shows which outside apps can access your Google Account.
After you empty Trash, personal Gmail users generally have no normal self-service way to restore deleted messages. Google Workspace administrators have separate recovery options; contact the account administrator promptly. A retention rule in Google Vault only helps if it was already in place before deletion, according to Gmail recovery guidance.
Keep a separate copy with mailmd #
For a local copy you control, mailmd is the best fit: it copies email from Gmail into a folder of Markdown files on your computer. It reads messages without marking them as read. It also leaves them in place, without moving or deleting them. Gmail’s All Mail is included by default, while Spam and Trash are left out unless requested.
Connect Gmail to make a copy:
-
Install mailmd in a terminal:
curl -fsSL https://raw.githubusercontent.com/vincentsch/mailmd/main/install.sh | sh -
Use your own OAuth app in Google Cloud to connect through the Gmail API, Google’s interface for programs that access Gmail. The app lets mailmd request access to your account:
mailmd connect gmail --client-secret client_secret.jsonWith an app password, you can also connect to Gmail through IMAP, an email protocol:
mailmd connect imap --email you@example.com -
Run the first sync, which copies your Gmail messages to the local archive:
mailmd sync
The files go in ~/mail/<account>. Each message becomes a Markdown file with its email headers, the details attached to the message. Attachments are saved beside the file. mailmd keeps existing archive files even if the matching message is later deleted from Gmail. That protects messages already copied; it cannot retrieve mail that was purged before the first sync.
mailmd does not free Gmail storage or import messages back into Gmail. After checking that the local copy is complete, delete messages in Gmail yourself if you want to free mailbox space. Include the archive folder in your regular backups so it remains available if the computer fails. See mailmd’s setup and code for connection details and options.
Free and open source
Try mailmd
mailmd is a free command-line tool that copies your email into Markdown files on your computer, one file per message. It works with any IMAP mailbox, and with Gmail and Outlook through their own APIs.
Install
$ curl -fsSL https://raw.githubusercontent.com/vincentsch/mailmd/main/install.sh | sh
Set it up with your coding agent
Set up mailmd so you can read my email. Use https://github.com/vincentsch/mailmd: read its AGENTS.md and follow the steps. Connect my mailbox and run the first sync. Then show me where the files are.