コード例 #1
0
        private EmailMessage BuildProjectRecommendationsMessage(UserEntity user, List <ProjectEntity> projects, SendGridTemplateDto template)
        {
            EmailMessage message     = new EmailMessage();
            EmailAddress toAddress   = new EmailAddress("", user.Email);
            EmailAddress fromAddress = _fromAddress;

            MailEngine.DTOs.Version templateV1 = template.Versions.First();
            message.ToAddresses.Add(toAddress);
            message.FromAddresses.Add(fromAddress);
            message.Subject = $"{templateV1.Subject} {_testEmailIndicator}";
            string htmlContent      = ReplaceMessageVariables(templateV1.HtmlContent, user, projects);
            string plainTextContent = ReplaceMessageVariables(templateV1.PlainContent, user, projects);

            message.MailContent.Add("text/html", htmlContent);
            message.MailContent.Add("text/plain", plainTextContent);
            return(message);
        }
コード例 #2
0
        private EmailMessage BuildLaunchShowcaseMessage(UserEntity user, SendGridTemplateDto template)
        {
            EmailMessage message     = new EmailMessage();
            EmailAddress toAddress   = new EmailAddress("", user.Email);
            EmailAddress fromAddress = _fromAddress;

            MailEngine.DTOs.Version templateV1 = template.Versions.First();
            message.ToAddresses.Add(toAddress);
            message.FromAddresses.Add(fromAddress);
            message.Subject = $"{templateV1.Subject} {_testEmailIndicator}";
            string htmlContent      = templateV1.HtmlContent.Replace("{{currentYear}}", DateTimeOffset.Now.Year.ToString());
            string plainTextContent = templateV1.PlainContent.Replace("{{currentYear}}", DateTimeOffset.Now.Year.ToString());

            message.MailContent.Add("text/html", htmlContent);
            message.MailContent.Add("text/plain", plainTextContent);
            return(message);
        }