【问题标题】:How to send secure email through Send Grid?如何通过 Sendgrid 发送安全电子邮件?
【发布时间】:2017-07-10 11:17:30
【问题描述】:

我在 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);

现在我想发送安全电子邮件。我通过下面的链接

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

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

【问题讨论】:

    标签: c# azure sendmail sendgrid sendgrid-api-v3


    【解决方案1】:

    如果您使用的是SendGrid v3 API,则完全不必担心 SMTP。您只需调用 Web API 即可发送电子邮件。所有调用都是 HTTPS。

    查看source code,注意https

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

    【讨论】:

    • 所以默认发送网格使用 https 协议
    【解决方案2】:

    我还在下面的 url 中发现,默认情况下 SendGrid 使用 TLS。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多