Email API Integration Guide with C#
Minimum code that you need to integrate Mailazy with your .Net application
Prerequisites
You need to complete these given prerequisites, you can skip the step if you have already completed.
- Sign up for a Mailazy account.
- Complete Domain Authentication.
- Generate the Mailazy Access Key
Integrate Mailazy with C#
Start Sending mail using the code provided below:
var client = new RestClient("https://api.mailazy.com/v1/mail/send");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-Api-Key", "<API KEY>");
request.AddHeader("X-Api-Secret", "<API SECRET>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{" +
"\"to\": [\"[email protected]\"]," +
"\"from\": \"Sender <[email protected]>\"," +
"\"subject\": \"<Subject>\"," +
"\"content\": [{\"type\": \"text/plain\",\"value\": \"<Content>\"}]" +
"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);