usr bin env python -coding utf8- import sys imaplib def main imap imap

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#! /usr/bin/env python
#-*-coding:utf8-*-
import sys, imaplib
def main():
imap = imaplib.IMAP4_SSL('imap.gmail.com', 993)
imap.login(sys.argv[1], sys.argv[2])
imap.select()
typ, data = imap.search(None, 'ALL')
imap.close()
if typ == 'OK':
print 'it works'
if __name__=='__main__':
main()