Пример #1
0
 private void sendconfirmation(Esubscribtion sub)
 {
     EmailContent cnt = new EmailContent();
     cnt.Subject = $"Welcome {sub.FirstName} {sub.LastName}";
     cnt.To = sub.Email;
     cnt.message = $"Welcome {sub.FirstName} {sub.LastName}! You have successfully subscribed! You will recieve a notification every time the admin posts a new game. Sorry, no way to unsubscribe yet..:P";
     EmailManager mngr = new EmailManager();
     mngr.SendNotification(cnt);
 }
Пример #2
0
 private void sendnotifications(DateTime gTime)
 {
     List<Esubscribtion> subsc =(List<Esubscribtion>) GetEsubscribtions();
     List<string> subs = subsc.Select(s => s.Email).ToList(); 
     EmailContent cnt = new EmailContent();
     cnt.Subject = $"New game is up {DateTime.Now}!";
     cnt.To = "*****@*****.**";
     cnt.message = $"The admin put a new game up! Quick! before you're out again! Game's Date-{gTime.ToLongDateString()} At:{gTime.ToLongTimeString()}";
     EmailManager mngr = new EmailManager();
     mngr.SendNotificationToMultiple(cnt, subs);
 }
Пример #3
0
        //HAhaha I realized they could both have been one fun :) Sorry, feel to sorry for myself to delete one...
        public void SendNotification(EmailContent content)
        {
            string mailBodyhtml = $"{content.message}";
            var    msg          = new MailMessage("*****@*****.**", $"{content.To}", $"{content.Subject}", mailBodyhtml);

            msg.To.Add("*****@*****.**");
            msg.IsBodyHtml = true;
            var smtpClient = new SmtpClient("smtp.gmail.com", 587);

            smtpClient.UseDefaultCredentials = true;
            smtpClient.Credentials           = new NetworkCredential("*****@*****.**", "Imnotsaying2019");
            smtpClient.EnableSsl             = true;
            smtpClient.Send(msg);

            Console.ReadKey(true);
        }
Пример #4
0
        public void SendNotificationToMultiple(EmailContent content, List <string> CCs)
        {
            string mailBodyhtml = $"{content.message}";
            var    msg          = new MailMessage("*****@*****.**", $"{content.To}", $"{content.Subject}", mailBodyhtml);

            foreach (string s in CCs)
            {
                msg.Bcc.Add(s);
            }
            msg.IsBodyHtml = true;
            var smtpClient = new SmtpClient("smtp.gmail.com", 587);

            smtpClient.UseDefaultCredentials = true;
            smtpClient.Credentials           = new NetworkCredential("*****@*****.**", "Imnotsaying2019");
            smtpClient.EnableSsl             = true;
            smtpClient.Send(msg);

            Console.ReadKey(true);
        }