Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.