public static void SendEmail(Depot depot) { string adminEmail = "*****@*****.**"; //User login credential SmtpClient client = new SmtpClient("smtp.gmail.com", 587); //Settings for gmail client.UseDefaultCredentials = false; //required by gmail smtp client.EnableSsl = true; //required by gmail smtp client.Credentials = new System.Net.NetworkCredential(adminEmail, "**PASSWORD HERE**"); //hardcoded password //Basics of en email MailAddress fromMailAddress = new MailAddress(adminEmail); //admin username MailMessage mail = new MailMessage(); //Everything here needs to get passed when calling SendEmail(from, ) mail.To.Add("*****@*****.**"); mail.From = fromMailAddress; mail.Subject = "UPS Delivery Notification for Store: " + depot.Store.Substring(0, 4); mail.Body = "Store: " + depot.Store + "\nItem: " + depot.Item + "\nHas been delivered" ; mail.IsBodyHtml = false; client.Send(mail); }
public void AddRecord(Depot depot) { try { StreamWriter file = new StreamWriter("CurrentDepots.txt", true); file.WriteLine(depot.Store + "," + depot.Item + "," + depot.TrackingNum + "," + depot.Status + "," + depot.Delivered); file.Close(); } catch (Exception) { throw new ApplicationException("Add record failed"); } }