Пример #1
0
		public async Task SendEmail(DeliveryInstructions instructions)
		{
			if (instructions.Enabled == false)
			{
				return;
			}

			var email = BuildEmailMessage(instructions);
			await mailer.SendEmail(email);
		}
Пример #2
0
		private string BuildEmailBody(DeliveryInstructions instructions)
		{
			var brand = instructions.Brand;
			var messageName = instructions.MessageTemplate;

			// Pull up message template and apply the data
			var messagePath = ioService.CombineAndMap(EmailPath, BrandedMessageFolder, brand, messageName);
			var messageTemplate = ioService.ReadAllText(messagePath);
			var message = templateResolver.ResolveTemplate(messageTemplate, instructions.Parameters);

			// Pull up brand template and apply the message
			var brandTemplatePath = ioService.CombineAndMap(EmailPath, BrandedTemplateFolder, brand + ".cshtml");
			var brandTemplate = ioService.ReadAllText(brandTemplatePath);
			var body = templateResolver.ResolveTemplate(brandTemplate, new { Body = message });

			return body;
		}
Пример #3
0
		private MailMessage BuildEmailMessage(DeliveryInstructions instructions)
		{
			var emailBody = BuildEmailBody(instructions);
			var email = new HtmlEmail(instructions, emailBody);
			return email;
		}
Пример #4
0
 public HtmlEmail(DeliveryInstructions instructions, string body)
     : base(instructions.From.Address, instructions.GetDelimitedRecipients(","), instructions.Subject, body)
 {
     base.BodyEncoding = instructions.BodyEncoding;
     base.IsBodyHtml = true;
 }