摘要: def SaveAttach():# login the pop3 server ,retrive the new mails ,and download the attachments dstdir =dirname+str(time.ctime(time.time()))+'.zip' print 'starts' pp = poplib.POP3_SSL(mail_host,mail_port) print 'connect successful' pp.set_debuglevel(1) pp.user(mail_user) pp.pas 阅读全文
posted @ 2013-12-25 17:32 马僧 阅读(2882) 评论(0) 推荐(0) 编辑
摘要: def SaveAttachImap():# login the imap server ,retrive the new mails ,and download the attachments. M = imaplib.IMAP4(mail_host,mail_port) #print M M.login(mail_user,mail_pass) M.select('INBOX',False) #result, message = M.select('INBOX',False) typ, data = M.search(None, 'UNSEEN 阅读全文
posted @ 2013-12-25 17:31 马僧 阅读(2231) 评论(0) 推荐(0) 编辑
摘要: def send_mail(to_list, sub, context):#sentmail to the maillist ''' to_list: 发送给谁 sub: 主题 context: 内容 send_mail("xxx@126.com","sub","context") ''' #print 'test begins' mail_host = "smtp.163.com" mail_user = "admin" mail 阅读全文
posted @ 2013-12-25 17:29 马僧 阅读(919) 评论(0) 推荐(0) 编辑
摘要: 参考:http://www.cnblogs.com/dkblog/archive/2011/08/26/2155018.html通过logging.config模块配置日志#logger.conf###############################################[loggers] #有哪些日志记录器,这里有个root,还有2个example01,exampl02keys=root,example01,example02[logger_root]level=DEBUGhandlers=hand01,hand02[logge... 阅读全文
posted @ 2013-12-25 17:23 马僧 阅读(446) 评论(0) 推荐(0) 编辑