Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I would like to backup all messages without a label from Gmail. Those messages are basically all personal archived messages. I don't want the thousands of messages that are labeled for the various mailing lists that I am subscribed to, etc.

Is it possible to download only messages without label via POP3, IMAP, or whatever?

share|improve this question
    
I the issue downloading a subset of messages or identifying unlabeled messages? –  mhoran_psprep Dec 22 '13 at 21:52
    
@mhoran_psprep As I wrote, it's about downloading all unlabeled messages. –  feklee Dec 23 '13 at 9:51
    
Why the down vote? –  feklee Dec 23 '13 at 14:47
    
As you wrote your question you really have two questions: How do I find unlabeled messages; How do I download messages with label X. Both already have answers on the site. But which one are you having problems with. Gmail works best if you attach at least one label to a message/conversation before archiving it. –  mhoran_psprep Dec 23 '13 at 14:59
    
@mhoran_psprep It's one question: How do I download unlabeled messages? –  feklee Dec 23 '13 at 15:05
show 2 more comments

1 Answer

I'm not aware that it is possible to query Gmail for unlabeled emails using the POP3 or IMAP protocols.

One solution to bypass this is to go to Gmail, find all those emails and label them with a new label (perhaps temporary). Then, pick the "IMAP folder" (which is actually a label in Gmail world) with that same new label name to download, and retrieve the archived folder as an .mbox file.

I'm assuming you already know how to search for unlabeled messages in Gmail, but for anyone who wouldn't know, check this answer: How can I filter my Gmail messages that aren't labeled?

share|improve this answer
    
Could that process be automatized? –  feklee Dec 23 '13 at 10:32
    
For the labeling part, that seems hard, because I'm not aware of any Python script that would be able to find unlabeled messages (and there's no automation tool inside the gmail interface). For the downloading part, i.e. once they are already labeled, you could have a script that would download all emails of one label. Suggestion: always manually label every email that comes in (keyboard shortcuts!), and then backup the labels that you care for. Or setup a filter to tag all incomming emails with a "TEMP" tag, which you remove manually when it's an email you don't care for. –  Max Dec 23 '13 at 13:56
    
Thanks for all the suggestions, but that's totally not what I'm looking for. I know how to do automated downloads with POP3 or IMAP, and I know how to manually select unlabeled messages. What I'm looking for is a solution to download emails as described. As far as I know, IMAP supports search functionality — perhaps that could offer an approach. –  feklee Dec 23 '13 at 14:44
    
IMAP's search functionnalities are very generic and don't match Gmail's true advantage which is why you are struggling. It explains why a lot of people like me end up using the web interface even when native email clients have many advantages. Sorry. –  Max Dec 23 '13 at 15:36
1  
I just read that the Gmail IMAP server has an extension that provides “access to the full Gmail search syntax”: the X-GM-RAW search attribute –  feklee Feb 1 at 8:23
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.