1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-11-08 01:43:13 +00:00
Dotfiles/.config/polybar/themes/spacefull-dracula/polybar-scripts/inbox-imap-pythongpg/inbox-imap-python.py
2020-09-05 14:43:37 +03:00

15 lines
452 B
Python

#!/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()))