2006-11-17, 23:41
I never made any script,so please help me !
I would like to add a delete function in the mailscript from burriko :
http://xbmcscripts.com/index.php?option=...emid=Array
I added following line at the beginning of the script :
ACTION_PARENT_DIR = 9
And then following lines after def onAction :
I have two problems :
1) the subject isn't (or only a part) displayed in the dialog box (is it possible to add another line in a dialog box ?)
2) I can only delete 1 mail. After deleting this mail I can't quit the script anymore
I would like to add a delete function in the mailscript from burriko :
http://xbmcscripts.com/index.php?option=...emid=Array
I added following line at the beginning of the script :
ACTION_PARENT_DIR = 9
And then following lines after def onAction :
Code:
if action == ACTION_PARENT_DIR:
self.deletemail()
def deletemail(self):
dialog = xbmcgui.Dialog()
mail = poplib.POP3(SERVER)
mail.user(USER)
mail.pass_(PASS)
print "The server welcome message is : " , mail.getwelcome( )
numEmails = mail.stat()[0]
print "You have", numEmails, "emails"
for i in range(1, numEmails+1):
message = mail.retr(i)[1]
subject = ""
frommail = ""
for item in message:
if item.startswith("Subject"):
m = item.find("'") +9
n = item.find("'",m)
subject = item[m:n]
for item in message:
if item.startswith("From:"):
k = item.find("<") + 1
l = item.find(">",k)
frommail = item[k:l]
if dialog.yesno("Delete message from your mailbox ?","Msg " + str(i) +", FROM :" + str(frommail) + ", SUBJECT: " + str(subject) +" ?"):
print "Deleting mail ", i , " !!"
mail.dele(i)
print "Mail", i ," deleted !!"
mail.quit()
print "Connection to server closed"
time.sleep(1)
I have two problems :
1) the subject isn't (or only a part) displayed in the dialog box (is it possible to add another line in a dialog box ?)
2) I can only delete 1 mail. After deleting this mail I can't quit the script anymore