I am trying to get exact text that is sent on my gmail but i am also getting someother value also, following is my code.
import imaplib
server = imaplib.IMAP4_SSL ('imap.gmail.com', 993)
username = 'email'
password = 'pass'
server.login(username, password)
stat , content = server.select('Inbox')
stat , data = server.fetch(content[0],'(UID BODY[TEXT])')
print (data[0][1].decode())
server.close()
server.logout()
In this case my output is
--001a11443f6015ac310559254049
Content-Type: text/plain; charset="UTF-8"
hello
--001a11443f6015ac310559254049
Content-Type: text/html; charset="UTF-8"
<div dir="auto">hello</div>
--001a11443f6015ac310559254049--
But my message was only hello