Python 3 SDK added to Paubox Email API

Featured image

Share this article

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
Author Photo

About the author

Hoala Greevy

Founder of Paubox. Kayak fishing when I can. Native Hawaiian CEO.

Read more by Hoala Greevy

Get started with
end-to-end protection

Bolster your organization’s security with healthcare’s most trusted HIPAA compliant email solution

The #1-rated email encryption 
and security software on G2

G2 Badge: Email Encryption Leader Fall 2022
G2 Badge: Security Best Usability Fall 2022
G2 Badge: Encryption Momentum Leader Fall 2022
G2 Badge: Security Best Relationship Fall 2022
G2 Badge: Security Users Most Likely to Recommend Fall 2022
G2 Badge: Email Gateway Best Relationship Fall 2022
G2 Badge: Email Gateway Best Meets Requirements Fall 2022
G2 Badge - Users Most Likely to Recommend Summer 2022
G2 Badge: Email Gateway Best Results Fall 2022
G2 Badge: Email Gateway Best Usability Fall 2022
G2 Badge: Email Gateway Best Support Fall 2022
G2 Badge: Email Gateway Easiest To Use Fall 2022
G2 Badge: Email Gateway Easiest Setup Fall 2022
G2 Badge: Email Gateway Easiest Admin Fall 2022
G2 Badge: Email Gateway Easiest to do Business with Fall 2022
G2 Badge: Email Gateway Highest User Adoption 2022
G2 Badge: Email Gateway High Performer Fall 2022
G2 Badge: Email Gateway Momentum Leader Fall 2022
G2 Badge: Email Gateway Most Implementable Fall 2022
G2 Badge: Email Gateway Users Most Likely to Recommend Fall 2022