Skip to main content

API Wrapper Client for Mailsac

Project description

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.

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

pymailsac-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

pymailsac-0.1.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file pymailsac-0.1.2.tar.gz.

File metadata

  • Download URL: pymailsac-0.1.2.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

Hashes for pymailsac-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9ea61736aa28d57982128441128c62484298b8ca9256ac5e73db4b2e92191a66
MD5 eb0bd258fa59492296295545cecb8150
BLAKE2b-256 2659acdf22a347338a2ba2fddebdeb3df52b41554891f0e9e7c23cbcc5d313fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymailsac-0.1.2.tar.gz:

Publisher: upload-to-pypi.yml on GSejas/mailsac-pyclient

Attestations:

File details

Details for the file pymailsac-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pymailsac-0.1.2-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

Hashes for pymailsac-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dea882c25e7ded341669bd6686dc045669377d84ea1dddddeb9c9d56d1367fd1
MD5 06d2968e0c140fa354bf4366e812f118
BLAKE2b-256 d242b8af8762ee841f204b7107420efc26b9b7d07ab80b0de5b87c882363461e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymailsac-0.1.2-py3-none-any.whl:

Publisher: upload-to-pypi.yml on GSejas/mailsac-pyclient

Attestations:

Supported by

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