Skip to main content

Mailsac Client Library

Build Status PyPI Version License Python Version

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.

Metadata

Release files for pymailsac 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymailsac 0.1.4
File Size Uploaded
pymailsac-0.1.4.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymailsac 0.1.4
File Interpreter ABI Platform
pymailsac-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / pymailsac-0.1.4.tar.gz

Download URL pymailsac-0.1.4.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e6f479c8ff7bb23eb635e2334b1017aa90dac9311eee79b1b6a698a95f560ca7
BLAKE2b-256 checksum
How to use checksums
81ffebf3d53e6f695fe30f47fb64c723e19ac0e28e9e5ceb79a78b6bd5f6a55b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2024.

Transparency log

Release files / pymailsac-0.1.4-py3-none-any.whl

Download URL pymailsac-0.1.4-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb44480cf0f44a01ba016a983123d489ce0d98c3c692940fe38829531e982e4b
BLAKE2b-256 checksum
How to use checksums
4bce47d08add93ad9e6b75dda1755e39360c4cb0bfb7a173915a99ad2dbca747
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page