1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-11-23 16:41:31 +00:00
Dotfiles/.config/polybar/polybar-scripts/inbox-imap-pythongpg/inbox-imap-python.py

15 lines
452 B
Python
Raw Normal View History

2020-07-27 04:59:00 +00:00
#!/usr/bin/python
import imaplib
import os
import subprocess
completed_process = subprocess.run(['gpg', '-dq', os.path.join(os.getenv('HOME'), '.imappass.gpg')], check=True, stdout=subprocess.PIPE, encoding="utf-8");
password = completed_process.stdout[:-1]
obj = imaplib.IMAP4_SSL('imap.mail.net', 993)
# Only put your email address below.
obj.login('your email address', password)
obj.select()
print(len(obj.search(None, 'unseen')[1][0].split()))