-
-
Save nehaljwani/6048780 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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