API Wrapper Client for Mailsac
Project description
Mailsac Client Library
This is a Python client library for interacting with the Mailsac REST API. It provides a simple interface to receive, and manage emails using Mailsac's services. See full documentation for the API, here https://mailsac.com/docs/api/#section/About-the-API
Features
- Retrieve messages from your Mailsac inbox.
- Delete messages from your inbox.
Category | Endpoint | Method | Description | Implemented |
---|---|---|---|---|
Email Messages API | /addresses/{email}/message-count | GET | Count messages for an email inbox | No |
/addresses/{email}/messages | GET | List messages for an email inbox | Yes | |
/addresses/{email}/messages | DELETE | Delete all messages for an email inbox | No | |
/addresses/starred/messages | GET | List starred (saved) messages on the account | No | |
/addresses/{email}/messages/{messageId} | GET | Get email message metadata | Yes | |
/addresses/{email}/messages/{messageId} | DELETE | Delete an email message | Yes | |
/raw/{email}/{messageId} | GET | Get original SMTP message | No | |
/addresses/{email}/messages/{messageId}/headers | GET | Get parsed message headers | No | |
/dirty/{email}/{messageId} | GET | Get message HTML body (dirty) | No | |
/body/{email}/{messageId} | GET | Get message HTML body (sanitized) | No | |
/text/{email}/{messageId} | GET | Get message plaintext | Yes | |
/addresses/{email}/messages/{messageId}/star | PUT | Star (save) a message | No | |
/addresses/{email}/messages/{messageId}/labels/{label} | PUT | Add a label to a message | No | |
/addresses/{email}/messages/{messageId}/labels/{label} | DELETE | Remove a label from a message | No | |
/addresses/{email}/messages/{messageId}/folder/{folder} | PUT | Move a message into a folder | No | |
/addresses/{email}/messages/{messageId}/read/{readBoolean} | PUT | Set message read/unread status | No | |
/inbox | GET | Get all account messages paginated | No | |
/inbox-filter | GET | Filter messages in account by to, from, and/or subject | No | |
/inbox-search | GET | Search messages by to, from, and subject | No | |
/domains/{domain}/messages | GET | List messages for a domain | No | |
/domains/{domain}/delete-all-domain-mail | POST | Delete all messages in a domain | No |
Installation
To install the Mailsac client library, you can use pip:
pip install pymailsac
Usage
Here is a basic example of how to use the MailsacClient:
from pymailsac.client import MailsacClient
# Initialize the client
client = MailsacClient(api_key='your_api_key')
# Get messages
messages = client.get_messages('your_inbox_id')
# Delete a message
client.delete_message('your_inbox_id', 'message_id')
Client Initialization
sequenceDiagram
participant User
participant MailsacClient
User->>MailsacClient: Initialize with API key
MailsacClient-->>User: Client instance created
Fetching Messages
sequenceDiagram
participant User
participant MailsacClient
participant MailsacAPI
User->>MailsacClient: get_messages(email)
MailsacClient->>MailsacAPI: GET /addresses/{email}/messages
MailsacAPI-->>MailsacClient: JSON response with messages
MailsacClient-->>User: List of EmailMessage instances
Deleting a Message
sequenceDiagram
participant User
participant MailsacClient
participant MailsacAPI
User->>MailsacClient: delete_message(email, message_id)
MailsacClient->>MailsacAPI: DELETE /addresses/{email}/messages/{message_id}
MailsacAPI-->>MailsacClient: Success response
MailsacClient-->>User: True
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bugs.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
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
Built Distribution
File details
Details for the file pymailsac-0.1.3.tar.gz
.
File metadata
- Download URL: pymailsac-0.1.3.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72f54132f9cf57ab4419b6d252bb0e1b6cde29658af4e55407cac44f74e18d08 |
|
MD5 | d04525605074c58fa66739392007b36c |
|
BLAKE2b-256 | f2cb52baa19c12d06f8a21ee47de8109bb4075c643dee6c0fe8a21c6be234e78 |
Provenance
The following attestation bundles were made for pymailsac-0.1.3.tar.gz
:
Publisher:
upload-to-pypi.yml
on GSejas/mailsac-pyclient
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pymailsac-0.1.3.tar.gz
- Subject digest:
72f54132f9cf57ab4419b6d252bb0e1b6cde29658af4e55407cac44f74e18d08
- Sigstore transparency entry: 149445320
- Sigstore integration time:
- Predicate type:
File details
Details for the file pymailsac-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: pymailsac-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3592d107527b1beb434348d513f6909816d6906bfd35073cb7f4ee3fc5ed8e7 |
|
MD5 | 167f66a5155fefcb5219c28882886784 |
|
BLAKE2b-256 | 6fcb28f762cc6c8221add4929fdc9edb702f6427c6859020635d7f65c1e0a93c |
Provenance
The following attestation bundles were made for pymailsac-0.1.3-py3-none-any.whl
:
Publisher:
upload-to-pypi.yml
on GSejas/mailsac-pyclient
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pymailsac-0.1.3-py3-none-any.whl
- Subject digest:
a3592d107527b1beb434348d513f6909816d6906bfd35073cb7f4ee3fc5ed8e7
- Sigstore transparency entry: 149445321
- Sigstore integration time:
- Predicate type: