|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > imaplib - retrieving and deleting files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|