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.

  1. Sign up for a Mailazy account.
  2. Complete Domain Authentication.
  3. 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\": [\"example@example.com\"]," +
      "\"from\": \"Sender <sender@example.com>\"," +
      "\"subject\": \"<Subject>\"," +
      "\"content\": [{\"type\": \"text/plain\",\"value\": \"<Content>\"}]" +
    "}",  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);