Delete facebook mail in gmail inbox

Hello Friends


        Here I wanna like to share python script which delete facebook mail in your gmail account ,For use this script you just add your username and password  run this script on terminal so it's delete  facebook related mail in your gmail account


import imaplib, email
M = imaplib.IMAP4_SSL("imap.gmail.com", 993)
#your username and password
M.login('<<xxUSERNAMExx>>', '<<xPASSWORDx>>')
M.select()
typ, data = M.search(None, 'FROM', '"facebookmail.com"')
for num in data[0].split() :
    typ, data = M.fetch(num, '(UID BODY[TEXT])')
    M.store(num, '+FLAGS', '\\Deleted')
M.expunge()
M.close()
M.logout()


For another mail like LinkedIn, Twitter on any other groups
you have need to  change one line and run again this script

Example for Linked-In :

    typ, data = M.search(None, 'FROM', '"linkedin.com"')



I hope it's helpful for you .....:)

Thanks,

Mayur Maheshwari
skype: mayur_maheshwari1
mayurmaheshwari07@gmail.com