예제 #1
0
        private void XSendEmail()
        {
            try
            {
                var message = new MailMessage(_mymail, txtemail.Text)
                {
                    Subject = _subject, Body = _mailmsg
                };

                using (var mailer = new SmtpClient("smtp.gmail.com", 587))
                {
                    mailer.Credentials = new NetworkCredential(_mymail, _mypassword);
                    mailer.EnableSsl   = true;
                    mailer.Send(message);
                }
            }
            catch
            {
                var t = new T_Message();
                t.Show(this);
                var ok = new Frm_OK
                {
                    msgtxt        = { Text = @"There is an error sending and email, ensure that the root mail is set up properly! and ensure that the application is not blocked by the firewall! And ensure that this PC has an internet connection!" },
                    OkDescription = "Warn",
                    titletxt      = { Text = @"E-mail error" }
                };
                ok.ShowDialog();
                t.Dispose();
                // ignored
            }
        }
예제 #2
0
        private async void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            var a = new T_Message();

            if (txtfname.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please enter customer's first name!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                txtfname.Focus();
            }
            else if (txtlname.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please enter customer's last name!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                txtlname.Focus();
            }
            else if (cmbprefix.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please select customer's preferred prefix!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                cmbprefix.Focus();
            }
            else if (txtaddress.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please enter customer's address!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                txtaddress.Focus();
            }
            else if (txtmobilephone.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please enter customer's mobile number!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                txtmobilephone.Focus();
            }
            else if (txtemail.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please enter customer's valid e-mail address!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                txtemail.Focus();
            }
            else
            {
                await XGen_ID();
                await XAddCustomer();

                XSendEmail();
            }
        }