Skip to main content

SDK Python untuk Mailtarget API

Project description

Mailtarget Python SDK

The Mailtarget Python SDK enable NodeJs developer to work with Mailtarget API efficiently.

Getting Started

Requirement

Python 3

Installation

To install the SDK to your project, you could get the package from PyPi via following command.

pip install mailtarget_sdk

or You can clone this repository and install it manual to your env

git clone https://gitlab.com/mailtarget/integrations/mailtarget-python-sdk
cd mailtarget-pyhton-sdk
pip install .

Authentication

You have to create a mailtarget account to get an API Key. To manage your API Key navigate to the page by clicking Configuration on the navbar in the mailtarget dashboard and then select API Key.

Setup Client

Basic Usage

from mailtarget_sdk import Layang, Message, Address

layang = Layang("your_api_key")
content = """
<!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Layang</title>
    </head>
    <body style="font-family: "Roboto", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif">
        <h1>Hello World!!!</h1>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
        <br/><br/>
        <p style="color: #8A8A8A">powered by <a target="_blank" href="https://mailtarget.co" style="color: #8A8A8A">mailtarget</a></p>
    </body>
    </html>
"sender = Address(email = "no-reply@yoursendingdomain.test", name="Python")
recipients = [Address(email = "recipient@gmail.com", name="Wisnu")]

newMessage = Message(
    subject= "Hello from Python SDK",
    to=recipients,
    from_address=sender,
    body_html=content
)

response = layang.send(message=newMessage)

print(f'response {response}')

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

mailtarget_sdk-0.1.0.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

mailtarget_sdk-0.1.0-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

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