本文整理汇总了Python中poplib.POP3_SSL属性的典型用法代码示例。如果您正苦于以下问题:Python poplib.POP3_SSL属性的具体用法?Python poplib.POP3_SSL怎么用?Python poplib.POP3_SSL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类poplib
的用法示例。
在下文中一共展示了poplib.POP3_SSL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def check(email, password):
try:
email = email
password = password
pop3_server = "pop.163.com"
server = poplib.POP3(pop3_server)
#ssl加密后使用
#server = poplib.POP3_SSL('pop.163.com', '995')
print(server.set_debuglevel(1)) #打印与服务器交互信息
print(server.getwelcome()) #pop有欢迎信息
server.user(email)
server.pass_(password)
print('Messages: %s. Size: %s' % server.stat())
print(email+": successful")
except poplib.error_proto as e:
print(email+":fail")
print(e)
示例2: test_context
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def test_context(self):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
self.assertRaises(ValueError, poplib.POP3_SSL, self.server.host,
self.server.port, keyfile=CERTFILE, context=ctx)
self.assertRaises(ValueError, poplib.POP3_SSL, self.server.host,
self.server.port, certfile=CERTFILE, context=ctx)
self.assertRaises(ValueError, poplib.POP3_SSL, self.server.host,
self.server.port, keyfile=CERTFILE,
certfile=CERTFILE, context=ctx)
self.client.quit()
self.client = poplib.POP3_SSL(self.server.host, self.server.port,
context=ctx)
self.assertIsInstance(self.client.sock, ssl.SSLSocket)
self.assertIs(self.client.sock.context, ctx)
self.assertTrue(self.client.noop().startswith(b'+OK'))
示例3: test
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def test(config):
import poplib
logger = logging.getLogger('POPListenerTest')
server = poplib.POP3_SSL('localhost', config.get('port', 110))
logger.info('Authenticating.')
server.user('username')
server.pass_('password')
logger.info('Listing and retrieving messages.')
print server.list()
print server.retr(1)
server.quit()
示例4: main
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def main(hostname,port,user,password):
mailbox = poplib.POP3_SSL(hostname,port)
try:
mailbox.user(user)
mailbox.pass_(password)
response, listings, octet_count = mailbox.list()
for listing in listings:
number, size = listing.decode('ascii').split()
print("Message %s has %s bytes" % (number, size))
except poplib.error_proto as exception:
print("Login failed:", exception)
finally:
mailbox.quit()
开发者ID:PacktPublishing,项目名称:Learning-Python-Networking-Second-Edition,代码行数:19,代码来源:mailbox_basic_params.py
示例5: run
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def run(self):
value, user = getword()
user = user.replace("\n","")
value = value.replace("\n","")
try:
print "-"*12
print "[+] User:",user,"Password:",value
pop = poplib.POP3_SSL(server, 995)
pop.user(user)
pop.pass_(value)
print "\t\t\n\nLogin successful:",user, value
print "\t\tMail:",pop.stat()[0],"emails"
print "\t\tSize:",pop.stat()[1],"bytes\n\n"
success.append(user)
success.append(value)
success.append(pop.stat()[0])
success.append(pop.stat()[1])
pop.quit()
except (poplib.error_proto), msg:
#print "An error occurred:", msg
pass
示例6: receive_pop_email
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def receive_pop_email():
pop = poplib.POP3_SSL(host=pop_server)
pop.set_debuglevel(1)
pop.user(user)
pop.pass_(password)
# 列出邮件信息,包含邮件的大小和ID
pop_reslut = pop.list()
print(pop_reslut)
print("==========")
print(pop_reslut[2])
pop_stat = pop.stat()
# 第一项是代表的邮件ID
for index in range(1, pop_stat[0]):
print(pop.top(index, 0))
if index > 5:
break
print(pop.retr(1))
for line_content in pop.retr(1):
print(line_content)
示例7: setUp
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def setUp(self):
self.server = DummyPOP3Server((HOST, 0))
self.server.handler = DummyPOP3_SSLHandler
self.server.start()
self.client = poplib.POP3_SSL(self.server.host, self.server.port)
示例8: test__all__
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def test__all__(self):
self.assertIn('POP3_SSL', poplib.__all__)
示例9: getPopMail
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def getPopMail( mailDomain ):
if mailDomain in ['163','gmali','126','qq','sina']:
temp1 = 'pop.'+mailDomain+'.com'
mail = poplib.POP3_SSL(temp1)
elif ( mailDomain == 'hotmail' ):
mail = poplib.POP3_SSL('pop3.live.com')
elif ( mailDomain == 'yahoo' ):
mail = poplib.POP3_SSL('pop.mail.yahoo.com')
return mail
示例10: mailbruteforce
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def mailbruteforce(listuser,listpwd,type):
if len(listuser) < 1 or len(listpwd) < 1 :
print "[-] Error: An error occurred: No user or pass list\n"
return 1
for user in listuser:
for passwd in listpwd :
user = user.replace("\n","")
passwd = passwd.replace("\n","")
try:
print "-"*12
print "[+] User:",user,"Password:",passwd
# time.sleep(0.1)
if type in ['163','236']:
popserver = poplib.POP3(server,110)
else:
popserver = poplib.POP3_SSL(server,995)
popserver.user(user)
auth = popserver.pass_(passwd)
print auth
if auth.split(' ')[0] == "+OK" or auth =="+OK":
ret = (user,passwd,popserver.stat()[0],popserver.stat()[1])
success.append(ret)
#print len(success)
popserver.quit()
break
else :
popserver.quit()
continue
except:
#print "An error occurred:", msg
pass
示例11: setUp
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def setUp(self):
self.server = DummyPOP3Server((HOST, 0))
self.server.handler = DummyPOP3_SSLHandler
self.server.start()
self.client = poplib.POP3_SSL(self.server.host, self.server.port)
示例12: test__all__
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def test__all__(self):
self.assertIn('POP3_SSL', poplib.__all__)
示例13: connect
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def connect(self, host, port, ssl, timeout):
if ssl == '0':
if not port:
port = 110
fp = POP3(host, int(port), timeout=int(timeout))
else:
if not port:
port = 995
fp = POP3_SSL(host, int(port)) # timeout=int(timeout)) # no timeout option in python2
return TCP_Connection(fp, fp.welcome)
示例14: setUp
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def setUp(self):
self.server = DummyPOP3Server((HOST, PORT))
self.server.handler = DummyPOP3_SSLHandler
self.server.start()
self.client = poplib.POP3_SSL(self.server.host, self.server.port)
示例15: connect
# 需要导入模块: import poplib [as 别名]
# 或者: from poplib import POP3_SSL [as 别名]
def connect(self, host, port, ssl, timeout):
if ssl == '0':
if not port: port = 110
fp = POP3(host, int(port), timeout=int(timeout))
else:
if not port: port = 995
fp = POP3_SSL(host, int(port)) # timeout=int(timeout)) # no timeout option in python2
return POP_Connection(fp, fp.welcome)