The Paubox Python wrapper allows you to construct and send secure, HIPAA compliant messages. This package is the official Python wrapper for the Paubox Email API. The Paubox Email API allows your application to send secure, HIPAA compliant email via Paubox and track deliveries and opens. See Related: Python 3 SDK added to Paubox Email API See Also: Why Healthcare Businesses Choose the Paubox Email API
You will need to have a Paubox account. You can sign up here. Once you have an account, follow the instructions on the Rest API dashboard to verify domain ownership and generate API credentials.
$ echo "export PAUBOX_API_KEY='YOUR_API_KEY'" > .env $ echo "export PAUBOX_HOST='https://api.paubox.net/v1/YOUR_ENDPOINT_NAME'" >> .env $ echo ".env" >> .gitignore $ source .env
$ pip install paubox
import paubox from paubox.helpers.mail import Mail paubox_client = paubox.PauboxApiClient() 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 paubox_client = paubox.PauboxApiClient() 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)
import paubox import base64 from paubox.helpers.mail import Mail paubox_client = paubox.PauboxApiClient() recipients = ["recipient@example.com"] from_ = "sender@yourdomain.com" subject = "Testing!" attachment_content = base64.b64encode("Hello World!") content = { "text/plain": "Hello World!", "text/html": "
" } optional_headers = { "attachments": [{ "fileName": "the_file.txt", "contentType": "text/plain", "content": attachment_content }], 'reply_to': 'replies@yourdomain.com', 'bcc': 'recipient2@example.com' } mail = Mail(from_, subject, recipients, content, optional_headers) response = paubox_client.send(mail.get()) print(response.status_code) print(response.headers) print(response.text)Without the Mail Class Helper
import paubox import base64 paubox_client = paubox.PauboxApiClient() attachment_content = base64.b64encode("Hello World!") mail = { "data": { "message": { "recipients": [ "recipient@example.com" ], "bcc": ["recipient2@example.com"], "headers": { "subject": "Testing!", "from": "Sender <sender@yourdomain.com>", "reply-to": "Reply-to <replies@yourdomain.com>" }, "content": { "text/plain": "Hello World!", "text/html": "
" }, "attachments": [{ "fileName": "the_file.txt", "contentType": "text/plain", "content": attachment_content }] } } } response = paubox_client.send(mail) print(response.status_code) print(response.headers) print(response.text)
import paubox paubox_client = paubox.PauboxApiClient() disposition_response = paubox_client.get("SOURCE_TRACKING_ID") print(disposition_response.status_code) print(disposition_response.headers) print(disposition_response.text)