SunQuest
           Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 17th, 2004, 10:52 AM
Tryst Tryst is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 146 Tryst User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 26 m 49 sec
Reputation Power: 5
imaplib - retrieving and deleting files

Hi all,

I am writing a piece of code that retrieves emails from a server and is processing them accordingly (testing for spam). To add some additional functionality, I wish to delete emails from the server (in my case 'moppsy.comp.glam.ac.uk') once they have been read.

Does anyone have any knowledge or experince of doing this?

The function in which I connect to the server and retrieve the emails is below.

Code:
def collectEmail():
    m = imaplib.IMAP4('moppsy.comp.glam.ac.uk')
    m.login(getpass.getuser(), getpass.getpass())
    m.select()
    typ, data = m.search(None, 'ALL')
    print data
    for num in string.split(data[0]):
        print "\n"
        print "Email Number:", num
        typ, data = m.fetch(num, '(RFC822)')
        handleEmail(data[0][1])
    m.logout()


Edit: Added tags.

Cheers

Tryst
__________________
Tryst

Last edited by netytan : February 17th, 2004 at 12:29 PM.

Reply With Quote
  #2  
Old February 17th, 2004, 11:46 AM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 7
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Well, I can't seem to find a function to delete a message in imaplib, but I found one to expunge deleted ones ... odd. Other than using the send() method to send a raw command to delete a message, I am not sure how one would accomplish this.
__________________
Debian - because life's too short for worrying.
Best. (Python.) IRC bot. ever.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > imaplib - retrieving and deleting files


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway