Metadata-Version: 2.1
Name: 1secMail
Version: 1.0.0
Summary: Create and receive email in only 1 second! 📧 An API wrapper for www.1secmail.com written in Python.
Home-page: https://github.com/qvco/1secMail-Python
Download-URL: https://github.com/qvco/1secMail-Python
Author: qvco
Author-email: nikola.desuga@gmail.com
Maintainer: qvco
Maintainer-email: nikola.desuga@gmail.com
License: MIT
Keywords: 1secmail,onesecmail,tempmail,disposable,temporary,email,api,wrapper,library
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx (>=0.17.1)

  1secMail

An API wrapper for www.1secmail.com (https://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:

```bash
pip install 1secMail
```


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

```bash
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:

```python
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!

```python
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:

```python
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:

```python
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:

```python
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:

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

## Licnese

This software is licensed under the [MIT](https://github.com/qvco/1secMail-Python/blob/master/LICENSE) © [Qvco](https://github.com/qvco).
