I want to receive email using python. So far I have managed to get an item, but not a body. Here is the code I used:
import poplib from email import parser pop_conn = poplib.POP3_SSL('pop.gmail.com') pop_conn.user('myusername') pop_conn.pass_('mypassword')
My problem is that when I run this code, it returns the theme correctly, but not the body. Therefore, if I send an email with the subject โTesterโ and the body โThis is a test messageโ, it looks like IDLE.
>>>>Tester >>>>None
So, this seems to be accurately evaluating the subject, but not the body, I think this is correct in the parsing method? The problem is that I do not know enough about these libraries to figure out how to change it so that it returns both an object and a body.
python email
Matthew downey
source share