(It's A University Project)
Follow Me On Github For More Projects
Mohammed Ouedrhiri ©
Linkedin Account [Linkedin](https://www.linkedin.com/in/mohammed-ouedrhiri-512183187 “Linkedin”)
from tqdm import tqdm
from time import sleep
import imaplib
Give it Argument To Make it Relative To The Searching
def progress(listofmessages):
for i in tqdm(listofmessages, desc ="Progress : "):
sleep(.1)
mail = imaplib.IMAP4_SSL('imap.gmail.com',993)
The Library Attribute Needs Email Adress To Login Without Any Aythentication or Captcha(You Need a No Captcha and No Authentication Gmail with less secure apps Allow)
address = 'youreemail@gmail.com'
mypassword = 'password'
mail.login(address, mypassword)
def Inbox():
mail.select('Inbox')
typ,messageIds = mail.search(None,"UNSEEN")
Every Email in The Web Version has an Id and Index So I Transformed it to string to make it easy to count
messageIdsString = str(messageIds[0],encoding='utf-8')
listofmessages = messageIdsString.split(" ")
nbr = len(listofmessages)
if len(listofmessages)== 0:
I Repeated That Twice Because I've Found That the List Of Messages Take One Argument which is "b" or "ok" who goes with the string from html
progress(listofmessages)
print("You Have No Mails On Inbox")
elif len(listofmessages)== 0:
progress(listofmessages)
print("You Have No Mails On Inbox")
else :
progress(listofmessages)
print("You Have ",nbr,"New Emails Inbox")
def Spam():
mail.select('[Gmail]/Spam')
typ,messageIds = mail.search(None,"UNSEEN")
messageIdsString = str(messageIds[0],encoding='utf-8')
listofmessages = messageIdsString.split(" ")
nbr = len(listofmessages)
if len(listofmessages)== 0:
progress(listofmessages)
print("You Have No Mails On Spam")
elif len(listofmessages)== 0:
progress(listofmessages)
print("You Have No Mails On Spam")
else :
progress(listofmessages)
print("You Have ",nbr,"New Emails Spam")
def Sent():
mail.select('"[Gmail]/Messages envoy&AOk-s"')
typ,messageIds = mail.search(None,"SEEN")
messageIdsString = str(messageIds[0],encoding='utf-8')
listofmessages = messageIdsString.split(" ")
nbr = len(listofmessages)
if len(listofmessages)== 0:
progress(listofmessages)
print("You Have Sent No Email")
else :
progress(listofmessages)
print("You Have Sent ",nbr,"Emails")
def checking():
print("what Are you planning To Check ? ")
print("Here is the List : ")
print("I : Inbox")
print("S : Spam")
print("E : Sent")
an = input("Enter here : ")
answer = an.lower()
print("We've Got your Answer Please Hold on !")
if answer == 'i':
Inbox()
elif answer == 's':
Spam()
elif answer == 'e':
Sent()
checking()
an = input("Still wanna Check (press any key) : ")
answer = an.lower()
while(answer != 'n'):
checking()
print("Thank You For Using Our Program Want To Check Again ?")
print('Y for yes / N for no')
answer = input()
Thanks For Using My Code If You Have Any Problem Contact Me On email : mouedrhiri492@gmail.com
Mohammed Ouedrhiri ©
