Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Vypsani stavu IMAP kvoty
import imaplib, re
import os
p = re.compile('d+')
# ---------------------------------
login="user@example.net"
password="password123"
imap_server="example.net"
imap_port=993
# ---------------------------------
M = imaplib.IMAP4_SSL(imap_server, imap_port)
M.login(login, password)
quotaStr = M.getquotaroot("INBOX")[1][1][0]
r = re.compile('\d+').findall(quotaStr.decode('utf-8'))
if r == []:
r.append(0)
r.append(0)
total = float(r[1])/1000
used = float(r[0])/1000
print('Quota = %d MB'%( int(total) ))
print('Used = %d MB'%( int(used) ))
M.logout()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.