Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76660

how to copy emails into local directory?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <elearn2014@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'skip:[ 20': 0.04; 'skip:\\ 10': 0.09; 'subject:into': 0.09; 'python': 0.11; '"/"': 0.16; 'code?': 0.16; '(the': 0.22; 'import': 0.22; 'header:User- Agent:1': 0.23; 'skip:" 20': 0.27; 'skip:c 30': 0.32; 'received:google.com': 0.35; 'subject:?': 0.36; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'subject:emails': 0.60; 'mailbox': 0.68
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=sfUrAJSewyvTxT2Q9jXrfqKimUwITVYP6NtHLqqI7P8=; b=j+u7clkMfn85CQpkxl2OkYfg1hgd/uV8aL/eipDFaNdJTEHiAEszlVPeWksljVfUDg S/VM+qmAqQ+7rKqIfLVrSWIbmTtv1HsXe4t64oATIkUo7xCsD1Uo8HKQgMUQrmBOyukm ZFQI+7GISMdxWEuyogX4072PO4j2SgsglEWY702GLEEFlj4TbLmEU35fJrINW8x6y3T9 wjaU4V46paGSIGUilFkKklA5RZTvIdTqr+Uetzxzemfu9QSEqS2X8I1TgHF0d3LMafqj btgz8ysTuJo0zmGjmCUIHCW/3o0K9O9yPFhnnAyK41rDVnsR5W5sfqIZq4G4kheDmFhO wj7A==
X-Received by 10.68.132.65 with SMTP id os1mr52524381pbb.82.1408536614514; Wed, 20 Aug 2014 05:10:14 -0700 (PDT)
Date Wed, 20 Aug 2014 20:09:52 +0800
From luofeiyu <elearn2014@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0
MIME-Version 1.0
To python-list@python.org
Subject how to copy emails into local directory?
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13203.1408536622.18130.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408536622 news.xs4all.nl 2895 [2001:888:2000:d::a6]:57069
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76660

Show key headers only | View raw


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 comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

how to copy emails into local directory? luofeiyu <elearn2014@gmail.com> - 2014-08-20 20:09 +0800

csiph-web