Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'subject:both': 0.07; '#print': 0.09; 'stored': 0.12; "%s'": 0.16; 'folder.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject: \n ': 0.16; 'subject:folder': 0.16; 'folder': 0.16; 'wrote:': 0.18; 'have:': 0.19; 'example': 0.22; 'print': 0.22; 'header:User- Agent:1': 0.23; 'copied': 0.24; 'header:In-Reply-To:1': 0.27; 'skip:( 20': 0.30; 'code': 0.31; "skip:' 10": 0.31; 'flags': 0.31; 'issuing': 0.31; 'anyone': 0.31; 'another': 0.32; 'subject:from': 0.34; 'could': 0.34; 'subject: (': 0.35; 'received:84': 0.35; 'should': 0.36; 'gmail': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'delete': 0.39; 'to:addr:python.org': 0.39; 'commands': 0.60; 'complete': 0.62; 'connecting': 0.64; 'header :Reply-To:1': 0.67; 'status:': 0.68; 'subject: & ': 0.68; 'reply- to:no real name:2**0': 0.71; 'account.': 0.80; 'reply- to:addr:python.org': 0.84; 'inbox': 0.93 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=ZMDuxxLb c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=0kkAYlmtguIA:10 a=2Rm01S65RToA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=o6AaF07DCzMA:10 a=4B_I4H9KAAAA:8 a=a8epihlez_fsz1dKdb8A:9 a=wPNLvfGTeEIA:10 a=Ih9UvN4dAWkA:10 X-AUTH: mrabarnett:2500 Date: Tue, 27 Aug 2013 00:56:09 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Imaplib & Gmail - cannot move from inbox to custom folder (message remains in both) References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377561358 news.xs4all.nl 15866 [2001:888:2000:d::a6]:46264 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53021 On 27/08/2013 00:34, rob@attoenterprises.com wrote: > I am using Imaplib and connecting to a Gmail account. I am issuing commands to copy the email to a custom folder then issuing delete. After expunge message still remains in inbox and customer folder. > > # COPY EMAIL TO FOLDER > copyStatus = m.copy(emailid, 'CIRIMPORTED') > print 'id of message copied is: %s status: %s' % (emailid,copyStatus) > > # SET THE MESSAGE TO HAVE '\Deleted' FLAG (EXPUNGE WILL COMPLETE DELETE PROCESS) > storeStatus = m.store(emailid,"+FLAGS", r'(\Deleted)') > print 'id of message stored is: %s status: %s %s' % (emailid,storeStatus[0],storeStatus[1]) > #print '******' > > #DELETES ANY EMAIL MARKED \Deleted > m.expunge() > m.close() > m.logout() > > Does anyone have any imaplib code the works with Gmail to move from inbox to another folder? > There's an example in docs which says: M.store(num, '+FLAGS', '\\Deleted') You have: m.store(emailid,"+FLAGS", r'(\Deleted)') Could it be that the flags should be r'\Deleted'?