1
Gmail에서 보내지는 정확한 텍스트를 얻으려고하지만 다음 코드도 있습니다.python을 사용하여 전자 메일 본문 읽기 3.6
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()
이 경우 내 출력은
--001a11443f6015ac310559254049
Content-Type: text/plain; charset="UTF-8"
hello
--001a11443f6015ac310559254049
Content-Type: text/html; charset="UTF-8"
<div dir="auto">hello</div>
--001a11443f6015ac310559254049--
입니다하지만 내 메시지는
https://stackoverflow.com/questions/2230037/how-to-fetch-an-email-body-using-imaplib-in-python – IsaacDj