如何通过 Sendgrid 发送安全邮件?

How to send secure email through Send Grid?

我正在借助 SendGrid 发送电子邮件。下面是代码。

            var client = new SendGridClient(apiKey);
            EmailAddress from = new 
            EmailAddress("a.b@mycompany.com", "Ashutosh");
            List<EmailAddress> tos = new List<EmailAddress>
            {
                new EmailAddress("a.b@mycompany.com", 
                                 "Ashutosh"),
            };

            StringBuilder emailBodyContent = new StringBuilder();
            var textContent = "Hi, ";
            emailBodyContent.AppendFormat("<p>Hi, </p>");
            emailBodyContent.AppendFormat("<p>This is your email.</p>");




            var emailSubject = "Attachment names are not unique";

            msg = MailHelper.CreateSingleEmailToMultipleRecipients(from, 
            tos, emailSubject, textContent, emailBodyContent.ToString());
            var response = await client.SendEmailAsync(msg);

现在我想发送安全电子邮件。我通过以下 link

https://sendgrid.com/docs/Classroom/Basics/Email_Infrastructure/smtp_ports.html

但是我还没有明白如何通过代码设置端口587或为发送网格启用安全电子邮件设置。

如果您使用的是 SendGrid v3 API,则根本不需要担心 SMTP。您只需调用网络 API 即可发送电子邮件。所有调用都是 HTTPS。

查看 source code,注意 https

private void InitiateClient(string apiKey, string host, ...)
{
    ...
    var baseAddress = host ?? "https://api.sendgrid.com";
    ...

我还在下面找到 url,它说默认情况下 SendGrid 使用 TLS。

https://sendgrid.com/blog/sendgrid-and-the-future-of-email-security/