Checking Imap With Python

by randalltux - 03-20-2016 at 01:21 PM
Junior Member
Posts:
1
Joined:
Mar 2016
Likes:
0
Reputation:
0
2 Year Of Member
#1
OP
Posted: 03-20-2016, 01:21 PM (This post was last modified: 03-20-2016, 01:21 PM by randalltux.)
To check the unread mail count in my IMAP account, i created a little Python sript. But because i don’t want to query the server every second, I’m caching the value in a file and update it every 30 seconds. Create a cronjob or similiar to update the file.

Code:
#!/usr/bin/env python

import imaplib

obj = imaplib.IMAP4_SSL('xxx.xxx.xxx.xxx', '993')
obj.login('user', 'password')
obj.select()
print len(obj.search(None, 'UnSeen')[1][0].split())

Originally posted on my blog
Reply
Find Posts
Junior Member
Posts:
3
Joined:
May 2016
Likes:
0
Reputation:
0
2 Year Of Member
#2
Posted: 05-30-2016, 07:55 AM
eh ada kang randalltux, terima kasih kang atas scriptnya..
Reply
Find Posts
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)