赞
踩
安装
pip install imapclient
使用案例
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # Created by LiTianYao on 2018/3/6
- #
-
- from imapclient import IMAPClient
-
-
- class Imapmail(object):
-
- def __init__(self): # 初始化数据
- self.serveraddress = None
- self.user = None
- self.passwd = None
- self.prot = None
- self.ssl = None
- self.timeout = None
- self.savepath = None
- self.server = None
-
- def client(self): # 链接
- try:
- self.server = IMAPClient(self.serveraddress, self.prot, self.ssl, timeout=self.timeout)
- return self.server
- except BaseException as e:
- return "ERROR: >>> " + str(e)
-
- def login(self): # 认证
- try:
- self.server.login(self.user, self.passwd)
- except BaseException as e:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。