Login to POP3 server and retrieve information : Email « Network « Python






Login to POP3 server and retrieve information

 

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

   
  








Related examples in the same category

1.Print out email message from your email box
2.Send email to two receivers
3.Get email message mymailbox.msg file
4.Sending Some E-Mail
5.MIME Multipart Messages
6.Send an email
7.Sending Mail over an SMTP Connection