⚡Synchronous Mail Client implementation.#
This module provides a synchronous client for the Mail.TM API.
- The client can be used to fetch data from the API, including account information, domain information, and messages.
- The client uses the 'requests' library to make HTTP requests to the API and the 'msgspec' library to decode the JSON responses from the API into Python objects.
- The client is easy to use and is designed to be used in a synchronous application.
- The API is documented at Mail.tm Documentation
You don't have to worry about:
- The client automatically handles errors and exceptions, so you don't have to.
- The client also handles rate limits, so you don't have to.
You do have to worry about:
- The client does not handle connection limits, so you might have to.
- The client does not handle SSL verification, so you might have to.
SyncMail
#
Synchronous client for the Mail.TM API.
PARAMETER | DESCRIPTION |
---|---|
account_token |
The account token to use for authentication. If not provided, the client will not be authenticated. |
Example
get_me
#
Gets the authenticated account.
RETURNS | DESCRIPTION |
---|---|
Optional[Account]
|
The account or None if the account is not authenticated. |
get_domains
#
get_domains() -> t.Optional[DomainPageView]
Get a page view of domains available under the account token provided to create a session.
RETURNS | DESCRIPTION |
---|---|
Optional[DomainPageView]
|
A page view of domains available under the account token provided to create a session. If not authenticated, returns None. |
get_domain
#
get_account
#
create_account
#
delete_account
#
get_messages
#
get_messages(page: int = 1) -> t.Optional[MessagePageView]
Get a page view of messages available under the account token provided to create a session.
PARAMETER | DESCRIPTION |
---|---|
page |
The page number to get. Defaults to 1.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[MessagePageView]
|
A page view of messages available under the account token provided to create a session. If not authenticated, returns None. |
get_message
#
delete_message
#
delete_message(message_id: str) -> None
Delete a specific message with ID.
PARAMETER | DESCRIPTION |
---|---|
message_id |
The ID of the message to delete.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None
|
|