예제 #1
0
        public async Task SendApplicationConfirmAsync(ApplicationView application)
        {
            var client = new SendGridClient(AlternateSendgridApiKey);

            List <string> occurrenceStrings = application.OccurrenceViews
                                              .Select(o => ToOccurrenceTimeString().Invoke(o))
                                              .ToList();

            var content = $"<p>Received application: {application.GetEmailMessage()}</p>" +
                          $"<p>{application.OpportunityDescription}</p>" +
                          $"<p><b>Address: {application.OpportunityAddress}</b></p>" +
                          $"<p><b>Times: <p>{string.Join("</p><p>", occurrenceStrings)}</p></b></p>" +
                          $"";
            SendGridMessage sendGridMessage = new SendGridMessage()
            {
                From             = new EmailAddress(FromEmail, "Volly Team"),
                Subject          = "Application For: " + application.OpportunityName,
                HtmlContent      = content,
                PlainTextContent = content
            };

            sendGridMessage.AddTo(new EmailAddress(application.Email, application.Name));
            sendGridMessage.AddCc(new EmailAddress(VollyConstants.AliceEmail, "Alice"));
            sendGridMessage.AddCc(new EmailAddress(VollyConstants.VollyAdminEmail, "VollyAdmin"));

            await client.SendEmailAsync(sendGridMessage);
        }