Send HIPAA compliant transactional email with C#

Featured image

Share this article

Send HIPAA Compliant Transactional Email with C# - Paubox

C Sharp for the Paubox Email API

The Paubox C# wrapper allows you to construct and send secure, HIPAA compliant messages. This package is the official C Sharp 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 ALSO: Why Healthcare Businesses Choose the Paubox Email API

Installation


Add the provided class library (Paubox.Email.API.dll and Newtonsoft.Json.dll) in your C# project by using ‘Add Reference’ option within the Project – References node.

Getting Paubox Email API Credentials

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.

Configuring API Credentials

Include your API credentials in a config file.

Add two app settings keys with their values in App.Config (For Desktop App, Windows Service) or Web.Config (For ASP.NET projects):


Adding the .NET Framework Configuration

This library supports .NET v4.6.1. Add the following to your config file:


Usage


Sending Messages using the Paubox C# Library

To send an email, prepare a Message object and call EmailLibrary.SendMessage method:

static SendMessageResponse SendMessage()
{
 Message message = new Message();
 Content content = new Content();
 Header header = new Header();
 message.Recipients = new string[] { "[email protected]",
 "[email protected]" };
 header.From = "[email protected]";
 message.Bcc = new string[] { "[email protected]" };
 header.Subject = "Testing!";
 header.ReplyTo = "[email protected]";
 content.PlainText = "Hello World!";
 message.Header = header;
 message.Content = content;
 SendMessageResponse response = EmailLibrary.SendMessage(message);
 return response;
}

Allowing non-TLS message delivery

If you want to send non-PHI mail that does not need to be HIPAA-compliant, you can allow the message delivery to take place even if a TLS connection is unavailable. This means a message will not be converted into a secure portal message when a unencrypted connection is encountered. For this, just set message.AllowNonTLS to true, as shown below:

static SendMessageResponse SendNonTLSMessage()
{
 Message message = new Message();
 Content content = new Content();
 Header header = new Header();
 message.Recipients = new string[] { "[email protected]",
 "[email protected]" };
 header.From = "[email protected]";
 message.Bcc = new string[] { "[email protected]" };
 header.Subject = "Testing!";
 header.ReplyTo = "[email protected]";
 content.PlainText = "Hello World!";
 message.AllowNonTLS = true;
 message.Header = header;
 message.Content = content;
 SendMessageResponse response = EmailLibrary.SendMessage(message);
 return response;
}

Checking Email Dispositions

To get email status for any source tracking id, call the EmailLibrary.GetEmailDisposition method:

static void GetEmailDisposition()
{
 GetEmailDispositionResponse response =
 EmailLibrary.GetEmailDisposition("2a3c048485aa4cf6");
}

Contributing


Bug reports and pull requests are welcome on GitHub at https://github.com/Paubox/paubox-csharp.

Try the Paubox Email API for FREE today.
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