I have an MBOX file of an old email account that I wanted to merge into Gmail as an alias.

However, this MBOX file has a bunch of spam emails in it that I want to basically verify and discard.

If I import emails to Gmail are they passed through the spam filter and put into the SPAM folder if they're spam?

Hoping so! I was just planning to import them using an IMAP client by dragging them into the inbox or something.

An alternate plan would be to import them all into another Gmail account and then import THAT somehow to Gmail using Gmail's tools, but I wasn't sure what might/would trigger the spam filtering.

  • I don't think you'll get around pre-filtering it yourself. Any route that goes through the MTA would mess with the original mail headers. And anything that doesn't come in through the MTA is likely not subject to spam filtering. Have you asked the Google support? The question is a good one, but it's specific to the server implementation of which little is known, right? Jun 20, 2015 at 15:23
  • Hmm, I haven't actually tried this yet. It'd be magic if it just filtered all of the spam messages into the spam folder. That's kind of what I expect to be honest.
    – Ben Guild
    Jun 20, 2015 at 15:31

1 Answer 1


I'm not at all sure that Google's spam filters would be triggered by an import. SPAM filtering is normally done at the receipt time.

There are, however, Linux tools you can train with a bunch of emails, still don't think you would be able to use that to clean out the existing MBOX though.

You could instead try opening the file in Thunderbird or another client that directly supports MBOX format and manually clean it out that way but it might be a lot of work.

The final choice is to use this Python script that someone has written to filter SPAM out of MBOX files. I've not tried it and I strongly recommend taking a copy of the MBOX file before trying it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy