Skip to main content


1secMail

An API wrapper for www.1secmail.com written in Python.

About

This is an easy to use yet full-featured Python API wrapper for www.1secmail.com ↗ using the official 1secMail API. It allows you to easily create temporary email addresses for testing, verification, or other purposes where you need a disposable email address.

Install

To install the package, you'll need Python 3.8 or above installed on your computer. From your command line:

pip install 1secMail

Note If you're willing to install the development version, do the following:

git clone https://github.com/qvco/1secMail-Python.git

cd 1secMail-Python

pip install -r requirements.txt

pip install -e .

Usage

Generating Email Addresses

To generate a list of random email addresses, use the random_email() method:

import secmail

client = secmail.Client()

client.random_email(amount=3)
>>> ['c3fho3cry1@1secmail.net', '5qcd3d36zr@1secmail.org', 'b6fgeothtg@1secmail.net']

You can also generate a custom email address by specifying the username and domain:

Note Specifying a domain is optional!

client.custom_email(username="bobby-bob", domain="kzccv.com")
>>> 'bobby-bob@kzccv.com'

Receiving Messages

To wait until a new message is received, use the await_new_message() method:

message = client.await_new_message(address)

To check all messages received on a particular email address, use the get_inbox() method and pass the email address:

messages = client.get_inbox("bobby-bob@kzccv.com")
for message in messages:
    print(message.id)
    print(message.from_address)
    print(message.subject)
    print(message.date)

You can also fetch a single message using the get_message() method and passing the email address and message ID:

message = client.get_message(address="bobby-bob@kzccv.com", message_id=235200687)
print(message.id)
print(message.subject)
print(message.body)
print(message.text_body)
print(message.html_body)
print(message.attachments)
print(message.date)

Attachment Information

To check attachment information, loop through the attachments in the message object and print the filename, content type, and size:

for attachment in message.attachments:
    print(attachment.filename)
    print(attachment.content_type)
    print(attachment.size)

Licnese

This software is licensed under the MIT © Qvco.

Download files

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

Source Distribution

1secMail-1.0.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

1secMail-1.0.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file 1secMail-1.0.0.tar.gz.

File metadata

  • Download URL: 1secMail-1.0.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for 1secMail-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f9d7b6d13ca9e68efd023d145c071299f4c338f70951f6b0201b38124e54dfb2
MD5 874ed1f723d79246f1108eecd295456e
BLAKE2b-256 d9434c8542ec266b5a3579fa21f12eac7600d6ee787aae46a48eecc78c8d4495

See more details on using hashes here.

File details

Details for the file 1secMail-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: 1secMail-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for 1secMail-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c00209aee0d85a00943afc35d46533eff1e720c50fde5ce76c803444e2138f0
MD5 5473e54b33ebfb1fded733a056c18f5c
BLAKE2b-256 cb52c55223ae87801d1a2ccb677a152d8ce84546bf2674c251be49e2cbc51eff

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.0

2 files

1.1.0

2 files

This release

1.0.0 This release

2 files

0.5.0

2 files

Supported by

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