Example #1
0
        public bool SendAccountConfirmEmail(string email, string displayName, string subject, string confirmationLink)
        {
            if (string.IsNullOrEmpty(displayName) || string.IsNullOrEmpty(subject) || string.IsNullOrEmpty(confirmationLink))
            {
                return(false);
            }

            SmtpClient client = new SmtpClient("smtp.gmail.com", 587);

            client.EnableSsl             = true;
            client.UseDefaultCredentials = false;
            client.Credentials           = new NetworkCredential("*****@*****.**", "bangbangzz371");

            MailMessage mail = new MailMessage();

            mail.From = new MailAddress("*****@*****.**", displayName);
            mail.To.Add(email);
            mail.Subject = subject;

            mail.IsBodyHtml = true;

            EmailTemplateProcessor templateProcessor = new EmailTemplateProcessor(_env);
            var accountConfirmEmail = templateProcessor.GenerateAccountConfirmEmail(confirmationLink);

            mail.Body = accountConfirmEmail;

            client.Send(mail);

            return(true);
        }
Example #2
0
        public bool SendOderConfirmEmail(OrderEmailModel order)
        {
            if (order == null)
            {
                return(false);
            }

            SmtpClient client = new SmtpClient("smtp.gmail.com", 587);

            client.EnableSsl             = true;
            client.UseDefaultCredentials = false;
            client.Credentials           = new NetworkCredential("*****@*****.**", "bangbangzz371");

            MailMessage mail = new MailMessage();

            mail.From = new MailAddress("*****@*****.**", "ILovePaint - Order Confirmation");
            mail.To.Add("*****@*****.**");
            mail.Subject = $"ILovePaint #{order.Order.ID} - We have received your order!";

            mail.IsBodyHtml = true;

            EmailTemplateProcessor mailProcessor = new EmailTemplateProcessor(_env);
            string contents = mailProcessor.GenerateOrderConfirmMail(order);

            mail.Body = contents;

            client.Send(mail);

            return(true);
        }