/sparkpost-sdk-dotnetcore

SparkPost Sdk para .Net Core

Primary LanguageC#

sparkpost-sdk-dotnetcore

SparkPost Sdk para .Net Core

SDK adaptado a partir https://github.com/RoushTech/SparkPostDotNet. A documentação  a mesma.

Não esqueça de alterar a API Key no arquivo SparkPostClient

Sending an e-mail

public static async void SendEmail(string email, string contentHtml, string title)
  {
      try
      {
          var transmission = new Transmission();
          transmission.Content.From.EMail = "email";
          transmission.Content.From.Name = "name";
          transmission.Content.Subject = title;
          transmission.Content.Html = contentHtml;
          var recipient = new Recipient {Address = {EMail = email}};
          transmission.Recipients.Add(recipient);
          var spark = new SparkPostClient();
          await spark.CreateTransmission(transmission);

      }
      catch(Exception e)
      {
          Console.WriteLine("Erro de envio de email");
      }

  }