Python 3 SDK added to Paubox Email API

Our Big Ideas: Security, Reliability, and Ease of Use | Paubox

This month we released SDK support for Python 3 for Paubox Email API.

It should be noted we created a new project repo for Python 3. Our Python 2 SDK is still available.

As a recap, Paubox Email API allows developers to programmatically send HIPAA compliant email and track delivery status. Paubox Email API is HITRUST CSF certified.

By adding client library support for languages like Python, programmers can integrate and deliver secure email within minutes via our REST API.

Let’s dive into a quick example.

Installation

Getting Paubox API Credentials

You will need to have a Paubox account. You can sign up for free here.

Once you have an account, follow the instructions on the Paubox Email API dashboard to verify domain ownership and generate API credentials.

See Also: Paubox Email API Quickstart Guide

Configuring API Credentials

Include your API credentials in a config file (e.g. config.cfg)

PAUBOX_HOST: 'https://api.paubox.net/v1/YOUR_ENDPOINT_NAME'
PAUBOX_API_KEY: 'YOUR_API_KEY'

Next install config package using pip to load API credentials from config.cfg file:

$ pip3 install config

Install Package

$ pip3 install paubox-python3

Usage

Sending Messages with the Paubox Mail Helper

Sending via Paubox is easy. This is the minimum content needed to send an email.

import paubox
from paubox.helpers.mail import Mail

from config import Config 
with open("config.cfg") as config_file:
    paubox_config = Config(config_file)

paubox_client = paubox.PauboxApiClient(paubox_config.PAUBOX_API_KEY, paubox_config.PAUBOX_HOST)
recipients = ["[email protected]"]
from_ = "[email protected]"
subject = "Testing!"
content = {"text/plain": "Hello World!"}
mail = Mail(from_, subject, recipients, content)
response = paubox_client.send(mail.get())
print(response.status_code)
print(response.headers)
print(response.text)

Sending Messages without the Mail Helper Class

import paubox

from config import Config 
with open("config.cfg") as config_file:
    paubox_config = Config(config_file)

paubox_client = paubox.PauboxApiClient(paubox_config.PAUBOX_API_KEY, paubox_config.PAUBOX_HOST)
mail = {
    "data": {
        "message": {
            "recipients": [
                "[email protected]"
            ],
            "headers": {
                "subject": "Testing!",
                "from": "[email protected]"
            },
            "content": {
                "text/plain": "Hello World!",
            }
        }
    }
}
response = paubox_client.send(mail)
print(response.status_code)
print(response.headers)
print(response.text)
Try the Paubox Email API for Free

About the author

Hoala Greevy

Founder CEO Paubox. Kayak fishing when I can.

Read more by Hoala Greevy

Get started with
end-to-end protection

Bolster your organization's security with state-of-the-art email encryption and inbound email security.

Highest rated HIPAA compliant messaging solution on G2

EmailEncryption BestMeetsRequirements MeetsRequirements
SecureEmailGateway MostImplementable Total
SecureEmailGateway Leader Leader
SecureEmailGateway EasiestToUse EaseOfUse
SecureEmailGateway EasiestAdmin EaseOfAdmin
SecureEmailGateway BestUsability Total
SecureEmailGateway BestResults Total
SecureEmailGateway BestRelationship Total
EmailEncryption UsersMostLikelyToRecommend Nps
EmailEncryption MomentumLeader Leader