예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //string password = ConfigurationManager.AppSettings["password"];
            string encryptedstring = MyEncrypt.Encrypt("nhatkyty25", "654789spncompanyadmin368068...");

            textBox1.Text = encryptedstring;
            MessageBox.Show(encryptedstring);
        }
예제 #2
0
        public string SendMail(string toList, string from, string ccList, string subject, string body)
        {
            MailMessage message    = new MailMessage();
            SmtpClient  smtpClient = new SmtpClient();
            string      msg        = string.Empty;

            try
            {
                string encryptedstring = MyEncrypt.Encrypt("nhatkyty25", "cuibapmialao12345");

                MailAddress fromAddress = new MailAddress(from);
                message.From = fromAddress;
                message.To.Add(toList);
                if (ccList != null && ccList != string.Empty)
                {
                    message.CC.Add(ccList);
                }
                message.Subject    = subject;
                message.IsBodyHtml = true;
                message.Body       = body;
                // We use gmail as our smtp client
                smtpClient.Host                  = "smtp.gmail.com";
                smtpClient.Port                  = 587;
                smtpClient.EnableSsl             = true;
                smtpClient.UseDefaultCredentials = true;
                smtpClient.Credentials           = new System.Net.NetworkCredential(
                    "*****@*****.**", MyEncrypt.Decrypt(encryptedstring, "cuibapmialao12345"));

                smtpClient.Send(message);
                msg = "Gửi Mail Thành Công";
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            return(msg);
        }
예제 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            string decryptedstring = MyEncrypt.Decrypt(txtDecrypt.Text, "654789spncompanyadmin368068...");

            txtDecryptResult.Text = decryptedstring;
        }