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("", 993)
#your username and password
M.login('<<xxUSERNAMExx>>', '<<xPASSWORDx>>')
typ, data =, 'FROM', '""')
for num in data[0].split() :
    typ, data = M.fetch(num, '(UID BODY[TEXT])'), '+FLAGS', '\\Deleted')

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 =, 'FROM', '""')

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


Mayur Maheshwari
skype: mayur_maheshwari1