简体   繁体   中英

How to send secure email through Send Grid?

I am sending Email with the help of SendGrid. Below is the code for that.

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

Now I want to send Secure Email. I go through the below link

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

But I have not understood how to set port 587 through code or enable secure email setting for send grid.

If you're using the SendGrid v3 API you need not worry about SMTP at all. You simply call a web API to send e-mail. All calls are HTTPS.

Check out the source code , note the http s .

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

I also found below url which says that by default SendGrid uses TLS.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM