Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Search for emails in the wild

Project description

Mailpapa

pip install mailpapa
import mailpapa

res = mailpapa.search(company='safaricom', domain="safaricom.co.ke")

emails = res.emails

for email in emails:
    print(email.address)
    print(email.name)
    print(email.position)

# unfortunately linkedin hates crawling, this causes mailpapa to return an empty response.emails

#To make it easier and avoid Exceptions use

if res.ok:
  for email in res.emails:
    print(email.address)
    print(email.name)
    print(email.position)

Mailpapa accepts diiferent email patterns. By defaults it uses firstname.lastname@domain

first_last = mailpapa.ACCEPTED_PATTERNS.FIRST_LAST
res = mailpapa.search(company='safaricom', domain="safaricom.co.ke", pattern=first_last)

The following patterns are supported

import mailpapa

mailpapa.ACCEPTED_PATTERNS.FIRSTLAST # johndoe@contosdo.com
mailpapa.ACCEPTED_PATTERNS.LASTFIRST # doejohn@contosdo.com
mailpapa.ACCEPTED_PATTERNS.LAST # doe@contosdo.com
mailpapa.ACCEPTED_PATTERNS.FIRST # john@contosdo.com
mailpapa.ACCEPTED_PATTERNS.FIRST_LAST # john_doe@contosdo.com
mailpapa.ACCEPTED_PATTERNS.LAST_FIRST # doe_john@contosdo.com
mailpapa.ACCEPTED_PATTERNS.FIRSTDOTLAST # john.doe@contosdo.com
mailpapa.ACCEPTED_PATTERNS.LASTDOTFIRST # doe.john@contosdo.com
mailpapa.ACCEPTED_PATTERNS.FLAST # jdoe@contosdo.com
mailpapa.ACCEPTED_PATTERNS.LFIRST # djohn@contosdo.com
mailpapa.ACCEPTED_PATTERNS.FIRSTL #johnd@contosdo.com
mailpapa.ACCEPTED_PATTERNS.LASTF # doej@contosdo.com

Mailpapa also allows you to search multiple role. Defaults to ceo

roles = ["sales", "ceo", "finance"]

mailpapa.search(company='safaricom', domain="safaricom.co.ke", positions=roles)

# OR

mailpapa.search(company='safaricom', domain="safaricom.co.ke", positions="sales")

CLI

mailpapa -h

usage: mailpapa [-h] [-p PATTERN] [-r ROLE] [-j file] company domain

Search for Emails in the Wild

positional arguments:
  company               Company name
  domain                Company domain

optional arguments:
  -h, --help            show this help message and exit
  -p PATTERN, --pattern PATTERN
                        Email Pattern
  -r ROLE, --role ROLE  Employee Positions

Save Options:
  -j file, --json file  Save emails in a JSON file in the given location.
>>> mailpapa safaricom safaricom.co.ke -r sales

----------------------  ------------------------------------
Hidden Name           hidden.name@safaricom.co.ke
Hidden Name           hidden.name@safaricom.co.ke
Hidden Name           hidden.name@safaricom.co.ke
Hidden Name           hidden.name@safaricom.co.ke
Hidden Name           hidden.name@safaricom.co.ke
Hidden Name           hidden.name@safaricom.co.ke
Hidden Name           hidden.name@safaricom.co.ke
----------------------  ------------------------------------

How about we send email

config={
  "password": os.environ.get("SMTP_PASS", None),
  "host": os.environ.get("SMTP_HOST", None),
  "port": int(os.environ.get("SMTP_PORT", None))
}

# Params
email.sendmail(sender: str = None, subject: str = None, body: str = None, html: bool = False, config: dict =None)

email = res.emails[0]
email.sendmail(
    "myemail@contosdo.com", #sender
    subject="Canton Fair",
    body="Did you get the ticket to canton?",
    config=config
    )

https://support.google.com/accounts/answer/6010255

https://myaccount.google.com/lesssecureapps

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
mailpapa-0.1.5-py2.py3-none-any.whl (9.9 kB) Copy SHA256 hash SHA256 Wheel py2.py3
mailpapa-0.1.5.tar.gz (6.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page