如何解决如何从 aspx.vb 页面调用 SendGrid?
我正在尝试从 https://github.com/sendgrid/sendgrid-csharp 工作中获取 SendGrid 简单示例:
using System;
using System.Threading.Tasks;
using SendGrid;
using SendGrid.Helpers.Mail;
class Program
{
static async Task Main()
{
var apiKey = Environment.GetEnvironmentvariable("SENDGRID_API_KEY");
var client = new SendGridClient(apiKey);
var from = new EmailAddress("test@example.com","Example User");
var subject = "Sending with Twilio SendGrid is Fun";
var to = new EmailAddress("test@example.com","Example User");
var plainTextContent = "and easy to do anywhere,even with C#";
var htmlContent = "<strong>and easy to do anywhere,even with C#</strong>";
var msg = MailHelper.CreateSingleEmail(from,to,subject,plainTextContent,htmlContent);
var response = await client.SendEmailAsync(msg).ConfigureAwait(false);
}
}
我需要将其转换为 ASP.NET VB.NET,但首先我想弄清楚如何从 aspx.cs 页面调用该 Main 方法。
在 aspx.cs 页面中,我会做 C# 等价的:
Dim c As New Program()
With c
.Main()
End With
?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。