Thunderbirdã§Some messages could not be FETCHed (Failure)ã¨ããã¨ã©ã¼ãåºã
ãã°ããã®éãThunderbird(ã¨ããããShredder)ã§Gmail IMAPã使ã£ã¦ããã¨ã
Some messages could not be FETCHed (Failure)
ã¨ããã¨ã©ã¼ãåºãããã«ãªã£ã¦ãããã§ãããããå æ¸ãããã£ãããªã£ã¦ããã®ã§ã解決æ¹æ³ãæ¢ã£ã¦ã¿ã¾ããã
ã¨ãããããã°ã°ã£ã¦ã¿ããã§ããã解決æ¹æ³ãã¾ã¨ã¾ã£ã¦ããã¨ããã¯ç¡ããããªã®ã§ãã¾ã¨ãã¦ããã¾ãã
Thunderbirdã®ãããã³ã«ãã°ãåã
æåã«ããããããThunderbirdãã©ã®ã¡ãã»ã¼ã¸ã§ã¤ã¾ããã¦ããã®ããç¥ãå¿ è¦ãããã¾ããããã«ã¯ãThunderbirdã«ãããã³ã«ãã°ãåãã¦ãããå¿ è¦ãããã¾ããã¾ã¨ã¾ã£ã¦ããã¨ããã¨ãã¦ã¯ã
ãããã¾ããè¦ã¯ç°å¢å¤æ°ãè¨å®ãã¦ããèµ·åããã¨ãããããã¡ã¤ã«ãæ¸ãã¦ãã¨ããã¾ãããã³ãã³ãããã³ããããç´æã¡ã§ããã¾ãã¾ãããé©å½ãªãã£ã¬ã¯ããªã§ã
C:\work> set NSPR_LOG_MODULES=imap:5 C:\work> set NSPR_LOG_FILE=C:\work\imap.log c:\work> "C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
ã®ããã«ããã°ããã§ããThunderbirdã®ãã¹ã¯å ´åã«ãã£ã¦ã¯ä¿®æ£ãå¿ è¦ã§ãã
ãã°ãã§ãããªããããã®ãé²ãããã«ãã¨ã©ã¼ãåºããããã£ãã¨Thunderbirdã¯éãã¦ãã¾ãã¾ãããã
ãããã³ã«ãã°ã調ã¹ã
ãã¦ãä»ä½ã£ããimap.logã¨ãããããã³ã«ãã°ã§ããããã£ã¨ããéã«æ°åMBã¨ãã«ãªãã¾ã®ã§ãã¡ã¢å¸³ã ã¨å¾®å¦ã«è·ãéãããããã¾ãããããã®ãã¡ã¤ã«ããã
Some messages could not be FETCHed (Failure)
ãå«ãé¨åãæ¤ç´¢ãã¾ããã¨ã©ã¼ãä¸åããåºã¦ãªããã°ãå¼ã£ãããé¨åãä¸ã«æãããªãã¯ãã§ãã
åã®å ´åã ã¨ã
....<çç¥>.... 4492[e70e440]: e5cf000:imap.gmail.com:S-INBOX:SendData: 10 UID fetch 67394 (UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type)]) 4492[e70e440]: ReadNextLine [stream=ea584c8 nb=52 needmore=0] 4492[e70e440]: e5cf000:imap.gmail.com:S-INBOX:CreateNewLineFromSocket: 10 NO Some messages could not be FETCHed (Failure) ....<çç¥>....
ã¨ãªã£ã¦ãã¾ãããIMAPã¯è¤æ°æ¥ç¶ã®ãããã³ã«ãªã®ã§ãã¨ã©ã¼ã®åã®è¡ãã¨ã©ã¼ã®åå ã¨ã¯éããªãã®ã§ããããããããåã®è¡ãã¨ã©ã¼ã®åå ã§ããã¨èãã¦è¯ãã§ãããããã®é¨åã®ã®åã®è¡ãè¦ãã¨ã
10 UID fetch 67394 (UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type)])
ã¨ããã³ãã³ããçºè¡ãã¦ããã®ãåããã¾ããããã¯ãUID=67394ã®ã¡ã¼ã«ãããã¨ããã³ãã³ããªã®ã§ãçµå±ããã®ããUID=67394ã®ã¡ã¼ã«ããæªãããã¦ããããããã¨ãåããã¾ãã
ããã§ã®ç®çã¯ãã¨ããããããã®æªãããã¦ããã¡ã¼ã«ãåé¤ãããã¨ã«ãªãã¾ãã
Python imaplib
ãã¦ãIMAPãé§ä½¿ãã¦ã¡ã¼ã«ãåé¤ãããã®ã§ãããOpenSSLã§ã»ãã·ã§ã³ãå¼µã£ã¦IMAPãããã³ã«ãèªç±èªå¨ã«æãã人ãªãã¦æ®éã¯å± ã¾ããããããªããã®ã©ã¤ãã©ãªã¨ãããã°ã©ã ã使ããããå¾ãªãã§ãããããã§ã¯ãPythonã®imaplibã使ããã¨ã«ãã¾ãã
Pythonã¯ã
Download Python [www.python.org]
ãããã¦ã³ãã¼ãã§ãã¾ããã3.Xç³»ã ã¨ãimaplibãã¡ããã¨åããªãã£ã½ãã®ã§ã2.6ããã¦ã³ãã¼ããã¦ãã¤ã³ã¹ãã¼ã«ãã¦ãã ããã
ããããã¨ãã¹ã¿ã¼ãã¡ãã¥ã¼ã«ãIDLE (Python GUI)ãã¨ããã®ãã¤ã³ã¹ãã¼ã«ãããã®ã§ããããèµ·åãã¾ãã
ãã®ã¦ã£ã³ãã¦ã«å¯¾ãã¦ã次ã®è¡ãå ¥åãã¦ããã¾ãã
import imaplib s = imaplib.IMAP4_SSL('imap.gmail.com') s.login('ã¢ã«ã¦ã³ãå@gmail.com', 'ãã¹ã¯ã¼ã')
ããã§ãã¡ããã¨ãã°ã¤ã³ã§ããã°ã
('OK', ['ã¢ã«ã¦ã³ãå@gmail.com authenticated (Success)'])
ã®ããã«è¡¨ç¤ºããã¦ããã¯ãã§ãã
ããã«ãINBOXã«ç§»åããããã«ã次ã®ããã«å ¥åãã¾ãã
s.select()
ãã¾ãããã°ã次ã®ããã«è¡¨ç¤ºããã¾ããOKã®æ¬¡ã«ããã®ã¯ã¡ã¼ã«ããã¯ã¹å ã®ã¡ã¼ã«ç·æ°ã§ãã
('OK', ['67469'])
ã¡ã¼ã«ã®çªå·ã調ã¹ã
ãã¦ãUID=67394ã®ã¡ã¼ã«ãæ¶ãããã®ã§ãããæåã«ãã®ã¡ã¼ã«ãç¾å¨ã®ã¡ã¼ã«ããã¯ã¹å ã§ä½çªç®ã®ã¡ã¼ã«ãªã®ããç¹å®ããå¿ è¦ãããã¾ããããã«ã¯ã次ã®ããã«å ¥åãã¾ãã
s.search(None, 'UID', '67394')
ãã¾ãè¡ãã°ã
('OK', ['55569 (UID 67394)'])
ã®ããã«è¡¨ç¤ºããã¾ããããã§ããã®ã¡ã¼ã«ã®ã¡ã¼ã«ããã¯ã¹å ã§ã®çªå·ã55569ã§ãããã¨ãç¹å®ã§ãã¾ããã
ããããã²ã¨æãã«ãã®ã¡ã¼ã«ãæ¶ãã¦ãã¾ãããã¨ããã§ããããã®ã¡ã¼ã«ãä½è ãªã®ãç¥ããã¨ãåºæ¥ããªãç¥ããããã®ã§ããããã«ã¯ã
s.fetch('55569', '(BODY.PEEK[HEADER.FIELDS (From To Date Subject)])')
ã®ããã«ããã¾ãããã¾ããããããããã¾ããããªãã§ããããThunderbirdãåããããªã³ãã³ããå¦çãã¦ãã¾ããããªãããã§ãããã
ãã ããã®ã¡ã¼ã«ã®åå¾ã®ã¡ã¼ã«ãããã§ã¯ã55568, 55570ã«é¢ãã¦ã¯ãæ
å ±ãå¾ãããã§ãããããããããã«ã¤ãã¦ãDateãªã©ã確èªãããã¨ã«ãã£ã¦ããã¤ã®ã¡ã¼ã«ãå£ããã®ããããã¯ããããç¥ããã¨ã¯åºæ¥ã¾ããã¡ã¼ã«ãæ¶ãã¦ãã¾ãããã§ããããè¦æã®ããã«ããåå¾ã®ã¡ã¼ã«ãããã¯ç¢ºèªãã¦ããã¹ãã§ãããã
ãã¦ããããããã¡ã¼ã«ãåé¤ãã¾ãããã次ã®ã³ãã³ããå ¥åãã¦ãã ããã
s.store('55569', '+FLAGS', '\\Deleted')
ãã¾ãããã°ã
('OK', ['55569 (FLAGS (\\Seen \\Deleted))'])
ã®ããã«è¡¨ç¤ºããã¾ãããã®ã³ãã³ãã¯ãã¡ã¼ã«ã«\\Deletedã¨ãããã©ã°ãä»ä¸ããã ãã§ããå®éã«åé¤ããã«ã¯ããã®å¾ã«ã
s.expunge()
ã¨ããã³ãã³ããå®è¡ãã¾ãããã¾ãããã°ã
('OK', ['55569'])
ã¨è¡¨ç¤ºããã¾ããããã§ä½æ¥å®äºã§ãããã®ã¾ã¾ãã®ã¦ã£ã³ãã¦ãéãã¦ãã¾ã£ã¦ããã¾ãã¾ããããæã ã®ããã«åãã¦ãããGoogleæ§ã«å¤±ç¤¼ãªã®ã§ã
s.logout()
ã¨ããã¾ãããã