Send HIPAA compliant transactional email with Python
Python Library for Paubox Email API The Paubox Python wrapper allows you to construct and send secure, HIPAA compliant messages. This package is the...
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.
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
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
$ pip3 install paubox-python3
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 = ["recipient@example.com"]
from_ = "sender@yourdomain.com"
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)
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": [
"recipient@example.com"
],
"headers": {
"subject": "Testing!",
"from": "sender@yourdomain.com"
},
"content": {
"text/plain": "Hello World!",
}
}
}
}
response = paubox_client.send(mail)
print(response.status_code)
print(response.headers)
print(response.text)
Python Library for Paubox Email API The Paubox Python wrapper allows you to construct and send secure, HIPAA compliant messages. This package is the...
Ruby for Paubox Email API The Paubox Ruby gem allows you to construct and send secure, HIPAA compliant transactional email. This package is the...
Ruby on Rails Gem for Paubox Email API The Paubox Ruby on Rails Gem can be used ActionMailer in Ruby on Rails. This Gem is the official Ruby on...
Every Friday we bring you the most important news from Paubox. Our aim is to make you smarter, faster.