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程序设计有所帮助。

相关文章

php跨服务器访问方法小结

本文实例总结了php跨服务器访问方法。分享给大家供大家参考。具体分析如下: 近来项目中遇到跨服务器访问的问题,研究了好些日子,总结如下: 1、用file_get_contents方法...

尝试用最短的Python代码来实现服务器和代理服务器

尝试用最短的Python代码来实现服务器和代理服务器

一个最简单的服务器 Python拥有这种单独起一个服务器监听端口的能力,用标准库的wsgiref就行。 from wsgiref.simple_server import make...

Python XML RPC服务器端和客户端实例

Python XML RPC服务器端和客户端实例

一、远程过程调用RPC XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a tra...

python实现简单的TCP代理服务器

本文实例讲述了python实现简单的TCP代理服务器的方法,分享给大家供大家参考。 具体实现代码如下: # -*- coding: utf-8 -*- ''' filename:r...

python3写的简单本地文件上传服务器实例

python是个很好玩的东西?好吧我随口说的,反正因为各种原因(其实到底是啥我也不知道),简单的学习了下python,然后写了一个上传文件上服务器的小玩具练手。 大概功能是这样: 1、获...