email.retr은 이메일 본문에 중국어가있을 때 Strange = 20자를 검색합니다.
-
11-07-2019 - |
문제
self.logger.info(msg)
popinstance=poplib.POP3(self.account[0])
self.logger.info(popinstance.getwelcome())
popinstance.user(self.account[1])
popinstance.pass_(self.account[2])
try:
(numMsgs, totalSize)=popinstance.stat()
self.logger.info("POP contains " + str(numMsgs) + " emails")
for thisNum in xrange(1, numMsgs + 1):
try:
(server_msg, body, octets)=popinstance.retr(thisNum)
except:
self.logger.error("Could not download email")
raise
text="\n".join(body)
mesg=StringIO.StringIO(text)
msg=rfc822.Message(mesg)
MessageID=email.Utils.parseaddr(msg["Message-ID"])[1]
self.logger.info("downloading email " + MessageID)
emailpath=os.path.join(self._emailpath + self._inboxfolder + "\\" + self._sanitize_string(MessageID + ".eml"))
emailpath=self._replace_whitespace(emailpath)
try:
self._dual_dump(text,emailpath)
except:
pass
self.logger.info(popinstance.dele(thisNum))
finally:
self.logger.info(popinstance.quit())
(server_msg, body, octets) = popinstance.retr (thisnum) 이메일에 중국어가 포함되어있을 때 이메일 본문에서 = 20을 반환합니다.
이것을 어떻게 처리합니까?
이메일 텍스트 :
제목 : (B/L : 4363-0192-809.015) SI 15680XXXX436
=20
~에게
=20
Si가 동봉되었습니다
pls는 우리에게 BL 드래프트와 직불 메모를 보냅니다
=20
TKS
=20
미리
----- 원본 메시지 ----- = 20
해결책
아마도 인코딩 된 공간 문자 일 것입니다 인용문
다른 팁
사용 Quopri 문자열을 디코딩하는 모듈.
제휴하지 않습니다 StackOverflow