Skip to content

Instantly share code, notes, and snippets.

@nehaljwani
Forked from anku94/delPopMail.py
Created July 21, 2013 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nehaljwani/6048780 to your computer and use it in GitHub Desktop.
Save nehaljwani/6048780 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import poplib
import sys
lenArgs = len(sys.argv)
if lenArgs != 5:
print "\n\tDelete all messages from <startMsg> to <endMsg> on Students server\n"
print "\tUsage:./script <username>[without @students.iiit.ac.in] <password> <startMsg> <endMsg>\n"
sys.exit(0)
server = "students.iiit.ac.in"
port = 995
user = sys.argv[1]
password = sys.argv[2]
start = int(sys.argv[3])
end = int(sys.argv[4])
pop = poplib.POP3_SSL(server, port)
pop.user(user)
pop.pass_(password)
poplist = pop.list()
if poplist[0].startswith('+OK') :
for i in range(start, end):
pop.dele(i)
else:
print "Error"
pop.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment