Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76660 > unrolled thread
| Started by | luofeiyu <elearn2014@gmail.com> |
|---|---|
| First post | 2014-08-20 20:09 +0800 |
| Last post | 2014-08-20 20:09 +0800 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
how to copy emails into local directory? luofeiyu <elearn2014@gmail.com> - 2014-08-20 20:09 +0800
| From | luofeiyu <elearn2014@gmail.com> |
|---|---|
| Date | 2014-08-20 20:09 +0800 |
| Subject | how to copy emails into local directory? |
| Message-ID | <mailman.13203.1408536622.18130.python-list@python.org> |
import imaplib,email
user="xxxx"
password="yyyy"
con=imaplib.IMAP4_SSL('imap.gmail.com')
con.login(user,password)
con.list()
('OK', [b'(\\HasNoChildren) "/" "INBOX"', b'(\\Noselect \\HasChildren)
"/" "[Gma
il]"', b'(\\HasNoChildren \\Junk) "/" "[Gmail]/&V4NXPpCuTvY-"',
b'(\\HasNoChildr
en \\Trash) "/" "[Gmail]/&XfJSIJZkkK5O9g-"', b'(\\HasNoChildren
\\Flagged) "/" "
[Gmail]/&XfJSoGYfaAc-"', b'(\\HasNoChildren \\Sent) "/"
"[Gmail]/&XfJT0ZCuTvY-"'
, b'(\\HasNoChildren \\All) "/" "[Gmail]/&YkBnCZCuTvY-"',
b'(\\HasNoChildren \\D
rafts) "/" "[Gmail]/&g0l6Pw-"', b'(\\HasNoChildren \\Important) "/"
"[Gmail]/&kc
2JgQ-"'])
Now, i want to copy all the emails in the gmailbox of
"[Gmail]/&kc2JgQ-" (the important mailbox in my gmail"
into local directory "g:\emails",how can i do that in python code?
Back to top | Article view | comp.lang.python
csiph-web