【发布时间】:2018-01-16 03:48:39
【问题描述】:
我正在将电子邮件服务构建到我的应用程序中,有没有人使用 Azure SDK 在本地测试它的经验?还是只有在实际的 azure 应用中才有可能?
【问题讨论】:
我正在将电子邮件服务构建到我的应用程序中,有没有人使用 Azure SDK 在本地测试它的经验?还是只有在实际的 azure 应用中才有可能?
【问题讨论】:
还是只有在实际的 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();
【讨论】: