Can't send email through SendGrid

后端 未结 6 617
一个人的身影
一个人的身影 2021-01-15 15:58

I\'m following the example from SendGrid\'s site and as credentials I\'m pasting it what they gave me in the Azure portal. Still, I get this error message.

6条回答
  •  离开以前
    2021-01-15 16:52

    public static bool SendMailBySendGrid(string offMail, string mailFormatDetails,string subject,string ccMail=null,string bccMail=null)
    {
      string mailFromId = System.Configuration.ConfigurationManager.AppSettings["Sender"];
      SendGridMessage sndmsg = new SendGridMessage();
      sndmsg.From = new MailAddress(mailFromId);
      sndmsg.To = new MailAddress[] { new MailAddress(offMail) };
      if (!string.IsNullOrEmpty(ccMail))
        sndmsg.Cc = new MailAddress[] { new MailAddress(ccMail) };
      if(!string.IsNullOrEmpty(bccMail))
        sndmsg.Bcc = new MailAddress[] { new MailAddress(bccMail) };
      sndmsg.Subject = subject;         
      sndmsg.Html = "
    " + mailFormatDetails + "
    "; bool result= SendEmail(sndmsg); return result; }

    Include using SendGrid; in your project.

提交回复
热议问题