Skip to main content

Python SDK for EngageLab Email sending APIs.

Project description

engagelab-email

Python SDK for EngageLab Email sending APIs.

Supported sending APIs:

  • Normal email: POST /v1/mail/send
  • Template email: POST /v1/mail/sendtemplate
  • Calendar email: POST /v1/mail/sendcalendar
  • MIME email: POST /v1/mail/send_mime

Default base URLs:

  • Singapore: https://email.api.engagelab.cc
  • Turkey: https://emailapi-tr.engagelab.com

Install

pip install engagelab-email

Local Development

python -m pip install -e .
python -m unittest discover -s tests

Normal Email

from engagelab_email import EngageLabEmailClient

client = EngageLabEmailClient(
    api_user="your_api_user",
    api_key="your_api_key",
)

result = client.send({
    "from": "EngageLab Team <support@mail.engagelab.com>",
    "to": ["user@example.com"],
    "body": {
        "subject": "Welcome",
        "content": {
            "html": "<p>Hello from EngageLab</p>",
            "text": "Hello from EngageLab",
        },
    },
})

print(result)

Template Email

client.send_template({
    "from": "support@mail.engagelab.com",
    "to": ["user@example.com"],
    "body": {
        "template_invoke_name": "month_bill",
        "subject": "Monthly Bill",
        "vars": {
            "%name%": ["Jack"],
            "%money%": ["30"],
        },
    },
})

Calendar Email

client.send_calendar({
    "from": "EngageLab Team <support@mail.engagelab.com>",
    "to": ["user@example.com"],
    "body": {
        "subject": "Meeting",
        "content": {
            "html": "<p>Please join the meeting.</p>",
        },
        "calendar": {
            "time_zone_id": "Asia/Shanghai",
            "start_time": "2026-06-10 10:00:00",
            "end_time": "2026-06-10 11:00:00",
            "title": "Project Meeting",
            "organizer": {
                "name": "EngageLab",
                "email": "support@mail.engagelab.com",
            },
            "location": "Online",
        },
    },
})

MIME Email

client.send_mime({
    "from": "EngageLab Team <support@mail.engagelab.com>",
    "to": ["user@example.com"],
    "body": {
        "subject": "Raw MIME",
        "content": {
            "raw_message": "From: test@example.com\r\nTo: user@example.com\r\nSubject: Raw MIME\r\n\r\nHello",
        },
    },
})

Turkey Data Center

from engagelab_email import EngageLabEmailClient, TURKEY_BASE_URL

client = EngageLabEmailClient(
    api_user="your_api_user",
    api_key="your_api_key",
    base_url=TURKEY_BASE_URL,
)

Error Handling

from engagelab_email import EngageLabEmailError

try:
    client.send({"body": {}})
except EngageLabEmailError as error:
    print(error.status, error.code, error.response)

The SDK accepts request payloads in the same shape as EngageLab's REST API.

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

engagelab_email-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

engagelab_email-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file engagelab_email-0.1.0.tar.gz.

File metadata

  • Download URL: engagelab_email-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for engagelab_email-0.1.0.tar.gz
Algorithm Hash digest
SHA256 119adb218ff76647a2518f85ccb32543829c5d75a8e3ebc2d4e210e57f40992c
MD5 1e20eaae5163936fb183a20735c94539
BLAKE2b-256 caf33db35e4233d1977692477bfc650db24e2942f10d407f48df65c5e8fca1b7

See more details on using hashes here.

File details

Details for the file engagelab_email-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for engagelab_email-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 516f44c7cba8b95331c5c9979ab86c1c74597c27ea3983e29ac2d6945c498a6e
MD5 0920ef585e8b8759a4667a558fc2f9b0
BLAKE2b-256 b981d0c26fe3b0aaac8a5f6fe54a13cb3ad71ebdaa42206b93d78f4b368de8c0

See more details on using hashes here.

Supported by

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