发送或接收电子邮件的模块
jsrml的Python项目详细描述
srml
Author:Jeefy
电子邮件:jeefy163@163.com
Url:Github,PyPI
连接
SMTPConnect
一个简单的smtp连接类,用于连接smtp主机。
用四个参数初始化:
主机:指连接主机,如'smtp.qq.com'。
邮件:指用户的信息,格式为('email@some.com','password')。在
Notice:
The password is the password for login the smtp, imap, pop hosts.
ssl: decide whether use ssl to connect or not.
port: the connect port of the host.
- 登录
login(email, passwd)
,如果未给定param email或passwd,则在创建实例时使用info receive。在_ - 发送
send(msg)
,用消息类绑定。在_ - 关闭
close()
,断开与主机的连接并退出。在_
Can use
with SMTPConnect(...) as conn
.
Ifwith
is used, this would automatic use.login
method.
IMAP连接
几乎与SMTPConnect相同。在
- 登录
login(email, passwd)
,与SMTPConnect相同。在_ - 选择“文件夹”
select_folder('Folder name')
,根据list_folders()
选择文件夹 - 列出\u文件夹
list_folders()
,返回所有可选择的已存在文件夹。在_ - 关闭_文件夹
close_folder()
,关闭当前的select文件夹。
在_if need to unselect, use
.client.unselect_folder()
- 搜索
search(types=['ALL'])
,按类型搜索邮件,默认为“全部” - 取回
fetch(uid, types='BODY[]')
,根据搜索返回的uid获取消息。在_ - 取数
fetchall(types='BODY[]')
,返回所有消息。在_ - 退出
退出连接。在_
POPConnect
另请参见srml.popclient.popclient. 像poplib.POP文件或者poplib.POP_SSL. 更多信息,请参见python standard library
解析
根据中的字节分析MIME消息。
显示的主体请参见Parse.body
。
纯文本请参见Parse.text
。
参数或文件请参见Parse.get_params()
。
更多请参见Parse.dict
文件
类帮助保存文件。在
邮箱
所有连接的混合类
有关详细信息,请使用help(MailBox)
。在
在srml.mailG公司在
使用电子邮件对象的GUI版本。在
在srml.mailCli在
要使用电子邮件对象的cli版本。在
- 项目
标签: