Exemple #1
0
 public void fillLabels()
 {
     reserve_textBox1.ReadOnly = true;
     reserve_textBox1.Text     = RandomStr();
     ticket                = reserve_textBox1.Text;
     flight_label.Text     = "From " + FlightP.getDepName() + " to " + FlightP.getArrName();
     reserve_label.Text   += AccountP.getAccountName();
     payment_textBox2.Text = "$ " + Price.getCharge().ToString();
 }
Exemple #2
0
        private static void SendEmail(string emailTo)
        {
            string smtpAddress = "smtp.gmail.com";
            int    portNumber  = 587;
            bool   enableSSL   = true;

            string emailFrom = "*****@*****.**";
            string password  = "******";

            string subject = "Reservation Remove";
            string body    = "Hi,\nThis email to confirm that reservation " + ticketID + " has been removed from your account " + AccountP.getAccountName();

            try
            {
                using (MailMessage mail = new MailMessage())
                {
                    mail.From = new MailAddress(emailFrom);
                    mail.To.Add(emailTo);
                    mail.Subject    = subject;
                    mail.Body       = body;
                    mail.IsBodyHtml = true;
                    // Can set to false, if you are sending pure text.

                    //mail.Attachments.Add(new Attachment("C:\\SomeFile.txt"));
                    //mail.Attachments.Add(new Attachment("C:\\SomeZip.zip"));

                    using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                    {
                        smtp.Credentials = new NetworkCredential(emailFrom, password);
                        smtp.EnableSsl   = enableSSL;
                        smtp.Send(mail);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 /// <summary>
 /// Changes the Label in account form to display the Account owner's
 /// first and last name
 /// </summary>
 private void getLabel()
 {
     account_label.Text += AccountP.getAccountName();
 }