Esempio n. 1
0
        private MimeMessage CreateEmailMessage(HelpAndDonationMessage message)
        {
            var emailMessage = new MimeMessage();

            emailMessage.From.Add(new MailboxAddress(_configuration.From));
            emailMessage.To.AddRange(message.To);
            emailMessage.Subject = "Help And Donation";

            var bodyBuilder = new BodyBuilder()
            {
                HtmlBody = string.Format($"<h2>Name: {message.Name}</h2>\n<br/>" +
                                         $"<p>Email: {message.Email}</p>\n<br/>" +
                                         $"<p>Phone Number: {message.PhoneNumber}</p>\n<br/>" +
                                         $"<p>Id Number: {message.IdNumber}</p>\n<br/>" +
                                         $"<p>Pensioner Confirmation: {message.PensionerConfirmation}</p>\n<br/>" +
                                         $"<p>Number of Family Members: {message.NumberOfFamily}</p>\n<br/>" +
                                         $"<p>Province: {message.Province}</p>\n<br/>" +
                                         $"<p>Employment Status: {message.EmploymentStatus}</p>\n<br/>" +
                                         $"<p>{message.Message}</p>\n<br/>" +
                                         "Thank you")
            };

            emailMessage.Body = bodyBuilder.ToMessageBody();

            return(emailMessage);
        }
Esempio n. 2
0
        //End of Code


        //Help And Donation Settings
        public async Task SendMailAsync(HelpAndDonationMessage message)
        {
            var emailMessage = CreateEmailMessage(message);

            await SendAsync(emailMessage);
        }