I would like to log into my account with Python and get python to print the messages I received in my mailbox. I know how to connect
import getpass, poplib
user = 'my_user_name'
Mailbox = poplib.POP3_SSL('pop.googlemail.com', '995')
Mailbox.user(user)
Mailbox.pass_('my_password')
I don't know how to get Python to display my messages. I tried all the functions in the poplib doc. They only display numbers.
You have not posted your source code, but here is my response:
How to get the total number of messages:
How to get a specific message, knowing its number in the mailbox:
So the function you might need is retr, it returns a tuple. See here.
Careful it also sets the respective email as SEEN on the server! You can probably undo that, at least with IMAP you can.
And my implementation of a pop3 lib email read:
Also here is the POP3 connection, at least how I implemented it...sort of tricky using a string comparison, but it worked for my app:
if u want to use IMAP4. Use outlook python library, download here : https://github.com/awangga/outlook
to retrieve unread email from your inbox :
Using the POP3 example from the docs: