【问题标题】:using SendGrid email service with the Azure SDK将 SendGrid 电子邮件服务与 Azure SDK 结合使用
【发布时间】:2018-01-16 03:48:39
【问题描述】:

我正在将电子邮件服务构建到我的应用程序中,有没有人使用 Azure SDK 在本地测试它的经验?还是只有在实际的 azure 应用中才有可能?

【问题讨论】:

    标签: sendgrid azure-sdk-.net


    【解决方案1】:

    还是只有在实际的 azure 应用中才有可能?

    我们可以将 SendGrid 电子邮件服务用于本地和 azure 应用程序。我们可以从 Azure official tutorials 获得更多详细步骤。以下是我的测试演示代码

     var apiKey ="ApiKey";//System.Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
     var client = new SendGridClient(apiKey);
     var msg = new SendGridMessage()
     {
          From = new EmailAddress("x@example.com", "Send Grid"),
          Subject = "Hello World from the SendGrid CSharp SDK!",
          PlainTextContent = "Hello, Email!",
          HtmlContent = "<strong>Hello, Email!</strong>"
     };
     msg.AddTo(new EmailAddress("y@example.com", "Test User"));
     client.SendEmailAsync(msg).Wait();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-02
      • 1970-01-01
      • 1970-01-01
      • 2020-05-04
      • 1970-01-01
      • 2018-11-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多