home of the madduck/ blog/
Gmail sucks stinky goblin toes

I have used up my Gmail space. What now?

I decide to delete the oldest few thousand mails. But how? The UI clearly sucks for this purpose (who needs to delete with 2 Gb of space?), but Gmail fortunately allows POP3 access. So I put together this script as a quick hack (thanks Clint for the tip about coproc -- bash does not seem to be able to do this...):

#!/bin/zsh -e

  echo $@ >&p
  echo "sending: $@" >&2

  read line <&p
  echo "received: $line" >&2
  echo $line

coproc openssl s_client -connect pop.googlemail.com:995

while ! recv | grep -q '^\+OK'; do sleep 0.001; done

send user $1
recv > /dev/null
send pass $2
recv > /dev/null
send stat
set -- `recv`

for i in {1..$2}; do
  send dele $i
  recv > /dev/null

send quit
recv > /dev/null

exit 0

and off I go. The POP3 server only ever gives you access to a few hundreds of your mails, so I figured I'd just call this script a couple of times, until my inbox would be a little less full. (I should have used python and a POP3 module for this. :))

Yeah, but forget it. Deleting messages from the POP server doesn't delete the messages from the inbox. Not even If I set it in my preferences. Great.

New Gmail account created, my mission: fill their servers to the brim.

Update: apparently the bug has been fixed. Now messages deleted via POP3 are moved to the trash, where they remain for 30 days, or until I manually delete them. Magnificent, back to the old problem.

Will you please give me 5Gb additional space, Google?