/// <summary> /// Send email with a list of roles applied to new users in set groups /// </summary> /// <param name="graphServiceClient"></param> /// <param name="groups"></param> /// <returns></returns> public async static Task SendGridEmailNewGroups(List <string> groups) { List <KeyValuePair <string, string> > accounts = ReadCsv.GetEmailAccounts(); List <SendGrid.Helpers.Mail.EmailAddress> recipients = new List <SendGrid.Helpers.Mail.EmailAddress>(); foreach (var account in accounts) { string name = account.Key; string address = account.Value; var emailAddress = new SendGrid.Helpers.Mail.EmailAddress() { Name = name, Email = address }; recipients.Add(emailAddress); } await SendGridNewGroupRolesEmail(groups, recipients); }
/// <summary> /// Send error email /// </summary> /// <param name="errorMessage"></param> /// <param name="exMsg"></param> /// <returns></returns> public async static Task SendGridErrorEmail(string errorMessage, string exMsg) { List <KeyValuePair <string, string> > accounts = ReadCsv.GetEmailAccounts(); List <SendGrid.Helpers.Mail.EmailAddress> recipients = new List <SendGrid.Helpers.Mail.EmailAddress>(); foreach (var account in accounts) { string name = account.Key; string address = account.Value; var emailAddress = new SendGrid.Helpers.Mail.EmailAddress() { Name = name, Email = address }; recipients.Add(emailAddress); } await SendGridErrorEmail(errorMessage, exMsg, recipients); }