Skip to content
/ Mailkit Public

Mailkit is a light library for email scraping, uses imap_tools and some extras under the hood to make it more seamless to use.

Notifications You must be signed in to change notification settings

Redrrx/Mailkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mailkit is a light library for email scraping, uses imap_tools and some extras under the hood to make it more seamless to use.

Capabilities.

  • Check email login
  • Scrap emails with either subject, sender, keyword
  • Proxy support HTTP/S and SOCKS5
  • Command line version

Use cases.

Those uses cases are educational.

  • Account registration bots
  • Invoice download from emails
  • Scrap general links from emails
  • Fetch notifications

Known issues:

  • Logging is bugged
  • Some email providers don't use common RFC 3501 and RFC 6154 Standards for folder naming, to work around this i have to spam a diverse folder fetching that could rate limit the inbox.
  • Non async as its completely based on synchronous iteration of either folders or messages which could boost speed
  • The MailboxProxy wasn't tested with all providers, and Proxification_v2.py is very experimental.

Compatible email providers (flexible):

Provider Compatibility
Gmail
Yahoo
Mail.com
GMX
Mail.ru
Rambler.ru
Autorambler.ru
Outlook
Hotmail
AOL

Gmail has deprecated imap.

Installation.

for now clone this repository and import mailkit, later on i'll be packaging this proprely in pypi.

You also have the requirements.txt to install the required dependencies

Usage.

as a module it can be used like this.

# Import the MailKit class
from mailkit import MailKit

# Initialize the MailKit object
# Replace 'your_username', 'your_password' with your email and password
# Replace 'your_proxy_config' with your proxy configuration if you have one, otherwise set it to None
mailkit_instance = MailKit(user='your_username', password='your_password', proxy='your_proxy_config')

# Use the scrap method to search for emails
# Replace 'your_subject', 'your_sender', 'your_keyword' with the subject, sender, and keyword you want to search for
result = mailkit_instance.scrap(scrapsub='your_subject', sender='your_sender', keyword='your_keyword')

# Display the result
if result:
    print(f"Found {len(result)} emails matching the criteria.")
else:
    print("No emails found matching the criteria.")

CLI

as for the command line version, checking is currently the only way but scrapping one is not really helpful yet i'll consider adding ways to export content to a file or some IPC.

  • Check if a given email is valid
python main.py --check -e your_email@gmail.com -p your_password
  • Scrap emails with a specific subject
python main.py -e your_email@gmail.com -p your_password --scrap "Your Subject Here"
  • Use a proxy with HTTP type:
python main.py -e your_email@gmail.com -p your_password --scrap "Your Subject Here"
  • Use a proxy with SOCKS5 type and authentication:
python main.py -e your_email@gmail.com -p your_password --proxy_type SOCKS5
--proxy_addr 192.168.1.1 --proxy_port 8080 --proxy_username your_username --proxy_password your_password

To be implemented in the future:

  • Export scraped content to a text file or an IPC buffer
  • Send email over STMP
  • HTTP server to manage emails and have active checking and managment
  • Publish over pypi
  • Add Gmail auth and email managment backend as having only single instance is detrimental to performance

About

Mailkit is a light library for email scraping, uses imap_tools and some extras under the hood to make it more seamless to use.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages