C-Sharp
Here is an example of calling the API using the C# language.
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string url = "https://api.notifiedby.com/v1/email/send/";
var values = new Dictionary<string, string>
{
{ "recipient", "YOU@TESTEMAIL" },
{ "subject", "email from API" },
{ "body", "<h1>Email from API</h1><p>This is an <strong>HTML</strong> email body.</p>" },
{ "plain_body", "This is the plain text version of the email body." }
};
var content = new FormUrlEncodedContent(values);
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Api-Key YOUR_API_KEY");
HttpResponseMessage response = await client.PostAsync(url, content);
string responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
}
}
}
Example with Encryption Key
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string url = "https://api.notifiedby.com/v1/email/send/";
var values = new Dictionary<string, string>
{
{ "recipient", "YOU@TESTEMAIL" },
{ "subject", "email from API" },
{ "body", "<h1>Email from API</h1><p>This is an <strong>HTML</strong> email body.</p>" },
{ "plain_body", "This is the plain text version of the email body." }
};
var content = new FormUrlEncodedContent(values);
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Api-Key YOUR_API_KEY");
client.DefaultRequestHeaders.Add("Encryption-Key", "my-encryption-key");
HttpResponseMessage response = await client.PostAsync(url, content);
string responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
}
}
}