No tags :(

Share it

I can’t say I have been a prolific blogger in the last few years. On most days, once I’ve figured something out, I’m too tired or it’s too late to write about it. What a lame excuse really! I’ve decided to give it another attempt.

In all likelihood, I will post some code here at some point. To set up highlighting, I settled on a plugin called SyntaxHighlighter Evolved. I’m not entirely happy with the limited color choices and it’s too late to see if they can be customized (but hey, I wrote about it!).

I found the snippet below and modified it for my own purposes. You can pass in [“yourmailservername”, “yourusername”, “yourpassword”] and watch it delete all your mail! Very useful if you’ve migrated to gmail and you’ve already copied everything.

You can perhaps tell I’m new to Python… A nicer way would be to pass in a dictionary like {“server”: “servername”, “user”: “username”, “pwd”: “password}.

def delete_all_messages(account):
whenToQuit = 500
loop = 0
totalMessages = 0
while 1:
    M = poplib.POP3(account[0])
    numMessages = len(M.list()[1])
    if totalMessages == 0: totalMessages = numMessages

    i = 0
    for i in range(numMessages):
        print 'Deleted %d out of %d messages' % (loop * whenToQuit + i + 1, totalMessages)
        if i == whenToQuit - 1:
            loop = loop + 1
    if i != whenToQuit - 1: