Skip to main content

A basic wrapper around various temp mail sites, aiming to provide an almost identical api for every site. The main purpose of this is to provide an easy way to quickly register an account on various sites and then discard the email.

Project description

temp-mails

A basic wrapper around various temp mail sites, aiming to provide an almost identical api for every site.

The main purpose of this is to provide an easy way to use different temp mail services with almost the same api, meaning little refactoring is needed.
If there are any issues, please send me an email (bertigert@riseup.net) or create an issue, i cant test every email for every change I or the host makes.

Installation

While every python3 version should hypothetically work, python 3.12 is best

pip install temp-mails

Requirements

pip install requests beautifulsoup4 lxml websocket-client

Note that you may need to uninstall all websocket packages in order for websocket-client to function properly

Supported Sites (46)

In Progress

  • ...

unofficial = we use no official API, because the website does not offer one (at least for free)
semi-official = website hat an official API, but we don't use it, often because it is using RapidAPI or broken
official = we use the websites official API (RapidAPI or not) captcha = requires you to go onto the website and solve a captcha/verify your browser on the same IP. After that it should work for some requests/minutes.

Usage

Create an email on the site https://10minemail.com/

from temp_mails import Tenminemail_com

mail = Tenminemail_com() # Generate a random email address
print(mail.email) # get the name of the email (e.g. example@examplehost.com)

print(mail.get_inbox()) # get all emails in the inbox

data = mail.wait_for_new_email(delay=1.0, timeout=120) # wait for a new email for 120 seconds and get the email data
print(data)

print(mail.get_mail_content(message_id=data["_id"])) # get the content of the email

The wrapper api for each email host is very similar, so little refactoring is needed in order to change the email host. However, the email data may change in format or similar. One email host could just return a string with the html content of the email, another one could return a dict with subject, content etc, I will probably add better support for that at some point.
Also note that only some hosts support user defined names/domains.
Also note that the built in wait_for_mail can break if there are too many emails or too many emails at once. You can implement you own custom function for that case. It works for all my use cases though (registrations).

Websites I won't add at the moment

Project details


Download files

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

Source Distribution

temp_mails-2.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

temp_mails-2.0-py3-none-any.whl (52.4 kB view details)

Uploaded Python 3

File details

Details for the file temp_mails-2.0.tar.gz.

File metadata

  • Download URL: temp_mails-2.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for temp_mails-2.0.tar.gz
Algorithm Hash digest
SHA256 c985911b7229f46965e90d3b078db927781b38aa3f1fac74b1eb5e81674d41de
MD5 26d9558d5e9b763ba0c4bf0f772c3f20
BLAKE2b-256 8f534257cc82ee933fdea6396681057db179f5c2f91e8408ae6808e57600029e

See more details on using hashes here.

File details

Details for the file temp_mails-2.0-py3-none-any.whl.

File metadata

  • Download URL: temp_mails-2.0-py3-none-any.whl
  • Upload date:
  • Size: 52.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for temp_mails-2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89ae886a55f02d5035f1d15f987947973e8b997de76c9726dac1562464e9f172
MD5 b5375bc0d71ec2638f967115132f415f
BLAKE2b-256 107a80c1a0a940122851e3102eb77d46c929f4fe502eea144c29a47bf771d240

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page