2011-11-16 4 views

답변

4

imap에서 액세스하려는 모든 폴더. 그것은 메일 서버에 의해 허용되어야합니다.

예 : Gmail의 경우 아래 이미지에서 imap 액세스를 설정하는 방법을 확인하십시오. 여기

enter image description here

은 "IMAP에서 표시", "채팅"폴더에 대해 확인해야합니다.

그 후, 코드 조각 아래 시도 :

sock = imaplib.IMAP4_SSL("imap.gmail.com", 993) 
sock.login("your Email Id", "Password") 
lb_list = sock.list() # print 
#search for "Chats" folder and its signature 
#here, it is "[Gmail]/Chats" 
sock.select("[Gmail]/Chats", True) 
sock.search(None, '(ALL)') 
resp, data = sock.fetch('1:*', '(RFC822)') 

희망, 도움이 될 것입니다.

+0

검색 조건을 변경하는 방법. 채팅 사서함이 매우 길어 읽을 수 있습니다. –

관련 문제