python登录pop3邮件服务器接收邮件的方法

yipeiwu_com6年前服务器

本文实例讲述了python登录pop3邮件服务器接收邮件的方法。分享给大家供大家参考。具体实现方法如下:

import poplib, string
PopServerName = "mail.yourserver.com"
PopServer = poplib.POP3(PopServerName)
print PopServer.getwelcome()
PopServer.user('yourName')
PopServer.pass_('yourPass')
r, items, octets = PopServer.list()
msgid, size = string.split(items[-1])
r, msg, octets = PopServer.retr(msgid)
msg = string.join(msg, "\n")
print msg

希望本文所述对大家的Python程序设计有所帮助。

相关文章

ffmpeg 4.2.2最新文档说明 参数设置方法

说明:以下内容为机器翻译,有差错在所难免,但大体意思不会出错,原始文档请看这里: http://ffmpeg.org/ffmpeg.html#toc-Generic-options1简介ff...

Python搭建FTP服务器的方法示例

Python搭建FTP服务器的方法示例

Python版本 3.6.2 使用的ftp包:pyftpdlib    pip install pyftpdlib就可以下载安装了 FTP协议下载上传文...

Python通过命令开启http.server服务器的方法

前言 如果你急需一个简单的Web Server,但你又不想去下载并安装那些复杂的HTTP服务程序,比如:Apache,ISS等。那么, Python 可能帮助你。使用Python可以完成...

PHP 高并发和大流量框架解决方案

一、高并发的概念在互联网时代,并发,高并发通常是指并发访问。也就是在某个时间点,有多少个访问同时到来。二、高并发架构相关概念1、QPS (每秒查询率) : 每秒钟请求或者查询的数量,在互联网领域,指每...

django2+uwsgi+nginx上线部署到服务器Ubuntu16.04

django2+uwsgi+nginx上线部署到服务器Ubuntu16.04

1.前期准备 1.打开Terminal终端,执行以下命令,将项目所需要的依赖包,都记录到一个文件内备用。 pip freeze >requirements.txt 2.将项...