Example #1
0
        public FormOptions(String Pass)
        {
            InitializeComponent();
            pass = Pass;
            DataTable      tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");

            tbl = sql.SelectTable("select S1,S2,W1,W2,L1,L2,P1,P2 from MyMail");

            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                tbS1.Text = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][1].ToString().Trim().Length > 0)
            {
                tbS2.Text = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][2].ToString().Trim().Length > 0)
            {
                tbW1.Text = DesClass.Decrypt(tbl.Rows[0][2].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][3].ToString().Trim().Length > 0)
            {
                tbW2.Text = DesClass.Decrypt(tbl.Rows[0][3].ToString().Trim(), pass);
            }


            if (tbl.Rows[0][4].ToString().Trim().Length > 0)
            {
                tbL1.Text = DesClass.Decrypt(tbl.Rows[0][4].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][5].ToString().Trim().Length > 0)
            {
                tbL2.Text = DesClass.Decrypt(tbl.Rows[0][5].ToString().Trim(), pass);
            }

            tbP1.Text = tbl.Rows[0][6].ToString();
            tbP2.Text = tbl.Rows[0][7].ToString();

            tbl = sql.SelectTable("select name from PubKeySite");
            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                tbSite.Text = tbl.Rows[0][0].ToString().Trim();
            }
        }
Example #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     //send to server
     if (tbK1.Text.Trim() == "") { return; }
     DataTable tbl = new DataTable();
     SQLLiteconnect sql = new SQLLiteconnect("db.db3");
     tbl = sql.SelectTable("select L1 from MyMail");
     String mail = "";
     if (tbl.Rows[0][0].ToString().Trim().Length > 0)
     {
         mail = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
     }
     if (mail == "") { return; }
     String pubkey = tbK1.Text.Trim().Replace("<RSAKeyValue><Modulus>", "");
     pubkey = pubkey.Trim().Replace("</Exponent></RSAKeyValue>", "");
     String result = ServerAPIClass.SendPubKey(DesClass.Encode(mail), DesClass.Encode(pubkey));
       //  tbK2.Text = "<RSAKeyValue><Modulus>" + DesClass.Decode(ServerAPIClass.ReadPubKey(DesClass.Encode(mail), "http://localhost:8080")) + "</Exponent></RSAKeyValue>";
     if (result.Trim() == "OK")
     {
         MessageBox.Show("OK");
     }
     else
     {
         MessageBox.Show("ERROR");
     }
 }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "") { return; }

            if (File.Exists("db.db3") == false)
            {
                String def = sha256("123456");
                SQLLiteconnect sql = new SQLLiteconnect("db.db3");
                sql.SQLTransact("CREATE TABLE MyTable (pass String, pubkey String, privkey String)");
                sql.SQLTransact("CREATE TABLE MyContacts (name String, publickey String)");
                sql.SQLTransact("CREATE TABLE PubKeySite (name String)");
                sql.SQLTransact("INSERT INTO MyTable (pass,pubkey,privkey) VALUES('" + def +"','','')");
                sql.SQLTransact("CREATE TABLE MyMail(S1 String, P1 String, W1 String, L1 String, S2 String, P2 String, W2 String, L2 String,id Int)");
                sql.SQLTransact("INSERT INTO MyMail (S1,S2,W1,W2,L1,L2,P1,P2,id) VALUES('','','','','','','993','25',0)");
                sql.SQLTransact("INSERT INTO PubKeySite (name) VALUES('http://localhost:8080')");

            }
            else
            {
                String def = sha256(textBox1.Text.Trim());
                DataTable tbl = new DataTable();
                SQLLiteconnect sql = new SQLLiteconnect("db.db3");
                tbl= sql.SelectTable("select * from MyTable where pass='******'");
                if (tbl.Rows.Count == 0) { return; }

            }

            FormMain FM = new FormMain(textBox1.Text.Trim());
            FM.FormClosed += FM_FormClosed;
            this.Hide();
            FM.Show();
        }
Example #4
0
        public FormOptions(String Pass)
        {
            InitializeComponent();
            pass = Pass;
            DataTable tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");
            tbl = sql.SelectTable("select S1,S2,W1,W2,L1,L2,P1,P2 from MyMail");

            if (tbl.Rows[0][0].ToString().Trim().Length>0)
            {
                tbS1.Text = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][1].ToString().Trim().Length > 0)
            {
                tbS2.Text = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][2].ToString().Trim().Length > 0)
            {
                tbW1.Text = DesClass.Decrypt(tbl.Rows[0][2].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][3].ToString().Trim().Length > 0)
            {
                tbW2.Text = DesClass.Decrypt(tbl.Rows[0][3].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][4].ToString().Trim().Length > 0)
            {
                tbL1.Text = DesClass.Decrypt(tbl.Rows[0][4].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][5].ToString().Trim().Length > 0)
            {
                tbL2.Text = DesClass.Decrypt(tbl.Rows[0][5].ToString().Trim(), pass);
            }

            tbP1.Text = tbl.Rows[0][6].ToString();
            tbP2.Text = tbl.Rows[0][7].ToString();

            tbl = sql.SelectTable("select name from PubKeySite");
            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                tbSite.Text = tbl.Rows[0][0].ToString().Trim();
            }
        }
Example #5
0
        private void button1_Click(object sender, EventArgs e)//load header mail
        {
            if (date1.Value > date2.Value)
            {
                MessageBox.Show("ERROR period.");
                return;
            }
            sb = new StringBuilder();
            DataTable      tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");

            tbl = sql.SelectTable("select S1,S2,W1,W2,L1,L2,P1,P2 from MyMail");

            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                S1 = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][1].ToString().Trim().Length > 0)
            {
                S2 = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][2].ToString().Trim().Length > 0)
            {
                W1 = DesClass.Decrypt(tbl.Rows[0][2].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][3].ToString().Trim().Length > 0)
            {
                W2 = DesClass.Decrypt(tbl.Rows[0][3].ToString().Trim(), pass);
            }


            if (tbl.Rows[0][4].ToString().Trim().Length > 0)
            {
                L1 = DesClass.Decrypt(tbl.Rows[0][4].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][5].ToString().Trim().Length > 0)
            {
                L2 = DesClass.Decrypt(tbl.Rows[0][5].ToString().Trim(), pass);
            }

            P1 = tbl.Rows[0][6].ToString();
            P2 = tbl.Rows[0][7].ToString();

            if (S1 == "")
            {
                MessageBox.Show("Options failed"); return;
            }
            Loadheader();
        }
Example #6
0
 public FormReg()
 {
     InitializeComponent();
     string site = "http://localhost:8080";
     DataTable tbl = new DataTable();
     SQLLiteconnect sql = new SQLLiteconnect("db.db3");
     tbl = sql.SelectTable("select name from PubKeySite");
     if (tbl.Rows[0][0].ToString().Trim().Length > 0)
     {
         site = tbl.Rows[0][0].ToString().Trim();
     }
     webBrowser1.Navigate(site);
 }
Example #7
0
        public FormReg()
        {
            InitializeComponent();
            string         site = "http://localhost:8080";
            DataTable      tbl  = new DataTable();
            SQLLiteconnect sql  = new SQLLiteconnect("db.db3");

            tbl = sql.SelectTable("select name from PubKeySite");
            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                site = tbl.Rows[0][0].ToString().Trim();
            }
            webBrowser1.Navigate(site);
        }
Example #8
0
        public static string SendPubKey(string email, string pubkey)//отправляем pubkey
        {
            string         site = "http://localhost:8080";
            DataTable      tbl  = new DataTable();
            SQLLiteconnect sql  = new SQLLiteconnect("db.db3");

            tbl = sql.SelectTable("select name from PubKeySite");
            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                site = tbl.Rows[0][0].ToString().Trim();
            }

            string result = "";
            string url    = site + "/sendpubkey.php";

            WebResponse response = null;

            System.IO.StreamReader reader = null;
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.Method = "POST";
                string postData  = "mail=" + email + "&pubkey=" + pubkey;
                byte[] byteArray = Encoding.UTF8.GetBytes(postData);
                request.ContentType   = "application/x-www-form-urlencoded";
                request.ContentLength = byteArray.Length;
                Stream dataStream = request.GetRequestStream();
                dataStream.Write(byteArray, 0, byteArray.Length);
                dataStream.Close();
                response = request.GetResponse();
                reader   = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
                result   = reader.ReadToEnd();
            }
            catch
            {
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                if (response != null)
                {
                    response.Close();
                }
            }
            return(result);
        }
Example #9
0
        public RSAForm(String Pass)
        {
            InitializeComponent(); pass = Pass;
            DataTable tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");
            tbl = sql.SelectTable("select pubkey, privkey from MyTable");

            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                tbK1.Text = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][1].ToString().Trim().Length > 0)
            {
                tbK2.Text = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
            }

            try{
            //----lang load
            string selectLang = "en-EN";
            if (System.IO.File.Exists(@"lang.cfg"))
            {
                string[] lines = System.IO.File.ReadAllLines(@"lang.cfg");
                selectLang = lines[0];
            }
            if (selectLang != "en-EN")
            {
                string AssemblyName = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName;
                string pt = Path.GetDirectoryName(AssemblyName);
                string path = pt + @"\lang\" + selectLang.Trim() + ".lng";
                if (System.IO.File.Exists(path))
                {
                    string[] lines = System.IO.File.ReadAllLines(path);//--load

                    button1.Text = lines[34];
                    button3.Text = lines[9];
                    button2.Text = lines[35];
                    button4.Text = lines[11];
                    button5.Text = lines[36];
                    button6.Text = lines[49];
                    line1 = lines[25];
                }
            }
            }
            catch
            {
                MessageBox.Show("Error loading language file!");
            }
        }
Example #10
0
        public RSAForm(String Pass)
        {
            InitializeComponent(); pass = Pass;
            DataTable tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");
            tbl = sql.SelectTable("select pubkey, privkey from MyTable");

            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                tbK1.Text = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][1].ToString().Trim().Length > 0)
            {
                tbK2.Text = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
            }
        }
Example #11
0
        public RSAForm(String Pass)
        {
            InitializeComponent(); pass = Pass;
            DataTable      tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");

            tbl = sql.SelectTable("select pubkey, privkey from MyTable");

            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                tbK1.Text = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][1].ToString().Trim().Length > 0)
            {
                tbK2.Text = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
            }
        }
Example #12
0
 public void ListContact()
 {
     listBox1.Items.Clear();
     DataTable tbl = new DataTable();
     SQLLiteconnect sql = new SQLLiteconnect("db.db3");
     tbl = sql.SelectTable("select name, publickey from MyContacts");
     if (tbl.Rows.Count != 0)
     {
         for (int i = 0; i < tbl.Rows.Count; i++)
         {
             ContactClass CC = new ContactClass();
             CC.Mail = DesClass.Decrypt(tbl.Rows[i][0].ToString().Trim(), pass);
             CC.Publickey = DesClass.Decrypt(tbl.Rows[i][1].ToString().Trim(), pass);
             listBox1.DisplayMember = "Mail";
             listBox1.Items.Add(CC);
         }
     }
 }
Example #13
0
        //отправляем pubkey
        public static string SendPubKey(string email, string pubkey)
        {
            string site = "http://localhost:8080";
            DataTable tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");
            tbl = sql.SelectTable("select name from PubKeySite");
            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                site = tbl.Rows[0][0].ToString().Trim();
            }

            string result = "";
            string url = site+"/sendpubkey.php";

            WebResponse response = null;
            System.IO.StreamReader reader = null;
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.Method = "POST";
                string postData = "mail=" + email + "&pubkey=" + pubkey;
                byte[] byteArray = Encoding.UTF8.GetBytes(postData);
                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = byteArray.Length;
                Stream dataStream = request.GetRequestStream();
                dataStream.Write(byteArray, 0, byteArray.Length);
                dataStream.Close();
                response = request.GetResponse();
                reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
                result = reader.ReadToEnd();
            }
            catch
            {

            }
            finally
            {
                if (reader != null)
                    reader.Close();
                if (response != null)
                    response.Close();
            }
            return result;
        }
Example #14
0
        public void ListContact()
        {
            listBox1.Items.Clear();
            DataTable      tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");

            tbl = sql.SelectTable("select name, publickey from MyContacts");
            if (tbl.Rows.Count != 0)
            {
                for (int i = 0; i < tbl.Rows.Count; i++)
                {
                    ContactClass CC = new ContactClass();
                    CC.Mail                = DesClass.Decrypt(tbl.Rows[i][0].ToString().Trim(), pass);
                    CC.Publickey           = DesClass.Decrypt(tbl.Rows[i][1].ToString().Trim(), pass);
                    listBox1.DisplayMember = "Mail";
                    listBox1.Items.Add(CC);
                }
            }
        }
Example #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "")
            {
                return;
            }

            if (File.Exists("db.db3") == false)
            {
                String         def = sha256("123456");
                SQLLiteconnect sql = new SQLLiteconnect("db.db3");
                sql.SQLTransact("CREATE TABLE MyTable (pass String, pubkey String, privkey String)");
                sql.SQLTransact("CREATE TABLE MyContacts (name String, publickey String)");
                sql.SQLTransact("CREATE TABLE PubKeySite (name String)");
                sql.SQLTransact("INSERT INTO MyTable (pass,pubkey,privkey) VALUES('" + def + "','','')");
                sql.SQLTransact("CREATE TABLE MyMail(S1 String, P1 String, W1 String, L1 String, S2 String, P2 String, W2 String, L2 String,id Int)");
                sql.SQLTransact("INSERT INTO MyMail (S1,S2,W1,W2,L1,L2,P1,P2,id) VALUES('','','','','','','993','25',0)");
                sql.SQLTransact("INSERT INTO PubKeySite (name) VALUES('http://localhost:8080')");
            }
            else
            {
                String         def = sha256(textBox1.Text.Trim());
                DataTable      tbl = new DataTable();
                SQLLiteconnect sql = new SQLLiteconnect("db.db3");
                tbl = sql.SelectTable("select * from MyTable where pass='******'");
                if (tbl.Rows.Count == 0)
                {
                    return;
                }
            }


            FormMain FM = new FormMain(textBox1.Text.Trim());

            FM.FormClosed += FM_FormClosed;
            this.Hide();
            FM.Show();
        }
Example #16
0
        private void button2_Click(object sender, EventArgs e)
        {
            //send to server
            if (tbK1.Text.Trim() == "")
            {
                return;
            }
            DataTable      tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");

            tbl = sql.SelectTable("select L1 from MyMail");
            String mail = "";

            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                mail = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }
            if (mail == "")
            {
                return;
            }
            String pubkey = tbK1.Text.Trim().Replace("<RSAKeyValue><Modulus>", "");

            pubkey = pubkey.Trim().Replace("</Exponent></RSAKeyValue>", "");
            String result = ServerAPIClass.SendPubKey(DesClass.Encode(mail), DesClass.Encode(pubkey));

            //  tbK2.Text = "<RSAKeyValue><Modulus>" + DesClass.Decode(ServerAPIClass.ReadPubKey(DesClass.Encode(mail), "http://localhost:8080")) + "</Exponent></RSAKeyValue>";
            if (result.Trim() == "OK")
            {
                MessageBox.Show("OK");
            }
            else
            {
                MessageBox.Show("ERROR");
            }
        }
Example #17
0
        //загрузка контактов
        private void LoadContacts()
        {
            comboBox1.Items.Clear();

            DataTable tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");
            tbl = sql.SelectTable("select pubkey from MyTable");
            String privKey = "";
            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                privKey = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }

            ContactClass CC1 = new ContactClass();
            CC1.Mail = line4;
            CC1.Publickey = privKey;
            comboBox1.DisplayMember = "Mail";
            comboBox1.Items.Add(CC1);
            tbl = sql.SelectTable("select name, publickey from MyContacts");
            if (tbl.Rows.Count != 0)
            {
                for (int i = 0; i < tbl.Rows.Count; i++)
                {
                    ContactClass CC = new ContactClass();
                    CC.Mail = DesClass.Decrypt(tbl.Rows[i][0].ToString().Trim(), pass);
                    CC.Publickey = DesClass.Decrypt(tbl.Rows[i][1].ToString().Trim(), pass);
                    comboBox1.DisplayMember = "Mail";
                    comboBox1.Items.Add(CC);
                }
            }

            comboBox1.SelectedIndex = 0;
        }
Example #18
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (tbW3.Text.Trim().Length < 6)
            {
                MessageBox.Show("Error. Min length = 6"); return;
            }
            if (MessageBox.Show("Change your password?", "Change your password", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (tbS1.Text.Trim() == "")
                {
                    return;
                }
                if (tbP1.Text.Trim() == "")
                {
                    return;
                }
                if (tbL1.Text.Trim() == "")
                {
                    return;
                }
                if (tbW1.Text.Trim() == "")
                {
                    return;
                }
                if (tbS2.Text.Trim() == "")
                {
                    return;
                }
                if (tbP2.Text.Trim() == "")
                {
                    return;
                }
                if (tbL2.Text.Trim() == "")
                {
                    return;
                }
                if (tbW2.Text.Trim() == "")
                {
                    return;
                }
                if (tbSite.Text.Trim() == "")
                {
                    return;
                }

                SQLLiteconnect sql       = new SQLLiteconnect("db.db3");
                DataTable      tbl       = new DataTable();
                List <string>  ListParam = new List <string>();

                tbl = sql.SelectTable("select name, publickey from MyContacts");
                if (tbl.Rows.Count != 0)
                {
                    sql.SQLTransact("Delete from MyContacts");
                    for (int i = 0; i < tbl.Rows.Count; i++)
                    {
                        String pubkeycontact = DesClass.Decrypt(tbl.Rows[i][1].ToString().Trim(), pass);
                        String namecontact   = DesClass.Decrypt(tbl.Rows[i][0].ToString().Trim(), pass);
                        sql.SQLTransact("INSERT INTO MyContacts (name, publickey) VALUES('" + DesClass.Encrypt(namecontact, tbW3.Text.Trim()) + "','" + DesClass.Encrypt(pubkeycontact, tbW3.Text.Trim()) + "')");
                    }
                }

                String def = sha256(tbW3.Text.Trim());

                tbl = sql.SelectTable("select pubkey,privkey from MyTable");
                String pubkey  = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
                String privkey = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
                sql.SQLTransact("Delete from MyTable");

                sql.SQLTransactParam("INSERT INTO MyTable (pass,pubkey,privkey) VALUES('" + def + "','" + DesClass.Encrypt(pubkey, tbW3.Text.Trim()) + "','" + DesClass.Encrypt(privkey, tbW3.Text.Trim()) + "')", ListParam);

                pass = tbW3.Text.Trim();
                ListParam.Clear();
                sql.SQLTransact("Delete from MyMail");

                ListParam.Add(DesClass.Encrypt(tbS1.Text.Trim(), pass));
                ListParam.Add(DesClass.Encrypt(tbS2.Text.Trim(), pass));
                ListParam.Add(DesClass.Encrypt(tbW1.Text.Trim(), pass));
                ListParam.Add(DesClass.Encrypt(tbW2.Text.Trim(), pass));
                ListParam.Add(DesClass.Encrypt(tbL1.Text.ToLower().Trim(), pass));
                ListParam.Add(DesClass.Encrypt(tbL2.Text.Trim(), pass));
                ListParam.Add(tbP1.Text.Trim());
                ListParam.Add(tbP2.Text.Trim());
                sql.SQLTransactParam("INSERT INTO MyMail (S1,S2,W1,W2,L1,L2,P1,P2,id) VALUES(?,?,?,?,?,?,?,?,0)", ListParam);


                MessageBox.Show("Reopen application");
                Application.Exit();
            }
        }
Example #19
0
        private void button2_Click(object sender, EventArgs e)
        {
            try{

            String bodymail = rtbEnc.Text.ToString();
            String bodymail2 = "";
            DataTable tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");
            tbl = sql.SelectTable("select privkey from MyTable");
            String privKey = "";
            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                privKey = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }
            rtbDec.Text = "";
            int k = 0;
            while (bodymail.IndexOf("=") > 0)
            {
                k = bodymail.IndexOf("==");
                if (k <= 0)
                {
                    k = bodymail.IndexOf("=");
                    if (k > 0)
                    {
                        bodymail2 = bodymail.Substring(0, k + 1);
                        bodymail = bodymail.Remove(0, k + 1);
                        if (bodymail2.Length > 3)
                        {
                            //  MessageBox.Show(Parts[i]);
                            String part = bodymail2.Replace(".", "");
                            if (part.IndexOf("3D") == 0)
                            {
                                part = part.Remove(0, 2);
                            }
                            rtbDec.Text += DesClass.RSADec(part, privKey);

                        }
                    }
                }
                else
                {
                    bodymail2 = bodymail.Substring(0, k + 2);
                    bodymail = bodymail.Remove(0, k + 2);
                    if (bodymail2.Length > 3)
                    {
                        //  MessageBox.Show(Parts[i]);
                        String part = bodymail2.Replace(".", "");
                        if (part.IndexOf("3D") == 0)
                        {
                            part = part.Remove(0, 2);
                        }
                        rtbDec.Text += DesClass.RSADec(part, privKey);

                    }
                }
            }
            }
            catch
            {
                MessageBox.Show(line5);
            }
        }
Example #20
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (tbW3.Text.Trim().Length < 6) { MessageBox.Show("Error. Min length = 6"); return; }
            if (MessageBox.Show("Change your password?", "Change your password", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (tbS1.Text.Trim() == "") { return; }
                if (tbP1.Text.Trim() == "") { return; }
                if (tbL1.Text.Trim() == "") { return; }
                if (tbW1.Text.Trim() == "") { return; }
                if (tbS2.Text.Trim() == "") { return; }
                if (tbP2.Text.Trim() == "") { return; }
                if (tbL2.Text.Trim() == "") { return; }
                if (tbW2.Text.Trim() == "") { return; }
                if (tbSite.Text.Trim() == "") { return; }

                SQLLiteconnect sql = new SQLLiteconnect("db.db3");
                DataTable tbl = new DataTable();
                List<string> ListParam = new List<string>();

                tbl = sql.SelectTable("select name, publickey from MyContacts");
                if (tbl.Rows.Count != 0)
                {
                    sql.SQLTransact("Delete from MyContacts");
                    for (int i = 0; i < tbl.Rows.Count; i++)
                    {

                       String pubkeycontact= DesClass.Decrypt(tbl.Rows[i][1].ToString().Trim(), pass);
                       String namecontact =DesClass.Decrypt(tbl.Rows[i][0].ToString().Trim(), pass);
                       sql.SQLTransact("INSERT INTO MyContacts (name, publickey) VALUES('" + DesClass.Encrypt(namecontact, tbW3.Text.Trim()) + "','" + DesClass.Encrypt(pubkeycontact, tbW3.Text.Trim()) + "')");
                    }
                }

                String def = sha256(tbW3.Text.Trim());

                tbl = sql.SelectTable("select pubkey,privkey from MyTable");
                String pubkey = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(),pass);
                String privkey = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
                sql.SQLTransact("Delete from MyTable");

                sql.SQLTransactParam("INSERT INTO MyTable (pass,pubkey,privkey) VALUES('" + def + "','" + DesClass.Encrypt(pubkey, tbW3.Text.Trim()) + "','" + DesClass.Encrypt(privkey, tbW3.Text.Trim()) + "')", ListParam);

                pass = tbW3.Text.Trim();
                ListParam.Clear();
                sql.SQLTransact("Delete from MyMail");

                ListParam.Add(DesClass.Encrypt(tbS1.Text.Trim(), pass));
                ListParam.Add(DesClass.Encrypt(tbS2.Text.Trim(), pass));
                ListParam.Add(DesClass.Encrypt(tbW1.Text.Trim(), pass));
                ListParam.Add(DesClass.Encrypt(tbW2.Text.Trim(), pass));
                ListParam.Add(DesClass.Encrypt(tbL1.Text.ToLower().Trim(), pass));
                ListParam.Add(DesClass.Encrypt(tbL2.Text.Trim(), pass));
                ListParam.Add(tbP1.Text.Trim());
                ListParam.Add(tbP2.Text.Trim());
                sql.SQLTransactParam("INSERT INTO MyMail (S1,S2,W1,W2,L1,L2,P1,P2,id) VALUES(?,?,?,?,?,?,?,?,0)", ListParam);

                MessageBox.Show("Reopen application");
                Application.Exit();
            }
        }
Example #21
0
        private void button1_Click(object sender, EventArgs e)
        {
            //send
            if (comboBox1.SelectedIndex == -1)
            {
                return;
            }
            ContactClass CC = (ContactClass)comboBox1.Items[comboBox1.SelectedIndex];

            if (CC.Publickey.Trim() == "")
            {
                MessageBox.Show("No publickey"); return;
            }


            DataTable      tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");

            tbl = sql.SelectTable("select S1,S2,W1,W2,L1,L2,P1,P2 from MyMail");

            String S2 = "";
            String L1 = "";
            String L2 = "";
            String W2 = "";
            String P2 = "";

            if (tbl.Rows[0][1].ToString().Trim().Length > 0)
            {
                S2 = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][3].ToString().Trim().Length > 0)
            {
                W2 = DesClass.Decrypt(tbl.Rows[0][3].ToString().Trim(), pass);
            }


            if (tbl.Rows[0][4].ToString().Trim().Length > 0)
            {
                L1 = DesClass.Decrypt(tbl.Rows[0][4].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][5].ToString().Trim().Length > 0)
            {
                L2 = DesClass.Decrypt(tbl.Rows[0][5].ToString().Trim(), pass);
            }

            P2 = tbl.Rows[0][7].ToString();

            if (S2 == "")
            {
                MessageBox.Show("Options failed"); return;
            }
            if (W2 == "")
            {
                MessageBox.Show("Options failed"); return;
            }
            if (P2 == "")
            {
                MessageBox.Show("Options failed"); return;
            }
            if (L1 == "")
            {
                MessageBox.Show("Options failed"); return;
            }


            var    fromAddress  = new MailAddress(L1.Trim(), "");
            string fromPassword = W2.Trim();
            var    toAddress    = new MailAddress(CC.Mail.Trim(), "");

            const string subject = "Cryptomail";

            richTextBox1.Text += "**************************************************************************************";
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < richTextBox1.Text.Length; i++)
            {
                sb.Append(DesClass.RSAEnc(richTextBox1.Text.Substring(0, 40), CC.Publickey));
                richTextBox1.Text = richTextBox1.Text.Remove(0, 40);
                if (richTextBox1.Text.Length <= 40)
                {
                    sb.Append(DesClass.RSAEnc(richTextBox1.Text, CC.Publickey));
                    break;
                }
            }

            var smtp = new SmtpClient
            {
                Host                  = S2.Trim(),
                Port                  = Convert.ToInt32(P2.Trim()),
                EnableSsl             = true,
                DeliveryMethod        = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials           = new System.Net.NetworkCredential(fromAddress.Address, fromPassword)
            };

            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = sb.ToString(),
            })

            {
                // message.Headers.Add("X-Message-Flag", "Flagged");
                smtp.Send(message);
            }
            richTextBox1.Text = "";
            MessageBox.Show("OK");
        }
Example #22
0
        //read body mail
        private void listBox1_DoubleClick(object sender, EventArgs e)
        {
            //select from
            if (listBox1.SelectedIndex == -1) { return; }
            DataTable tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");
            tbl = sql.SelectTable("select privkey from MyTable");

            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                privKey = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }

            int k = 0;
            MailObjClass MO = (MailObjClass)listBox1.Items[listBox1.SelectedIndex];
            richTextBox1.Clear();
            richTextBox1.Text += "From: " + MO.Mailfrom + "\r\n";
            richTextBox1.Text += "Date: " + MO.Datesend + "\r\n";
            richTextBox1.Text += "\r\n";
            t = true;
            sb = new StringBuilder();
            ReadCryptoMail(Convert.ToInt32(MO.Nummail));
            String bodymail2 = "";
            String bodymail = sb.ToString();
            //richTextBox2.Text = sb.ToString();
            while (bodymail.IndexOf("=") > 0)
            {
                k = bodymail.IndexOf("==");
            if (k <= 0)
            {
                k = bodymail.IndexOf("=");
                if (k > 0)
                {
                    bodymail2 = bodymail.Substring(0, k + 1) ;
                    bodymail = bodymail.Remove(0, k + 1);
                    if (bodymail2.Length > 3)
                    {
                        //  MessageBox.Show(Parts[i]);
                        String part = bodymail2.Replace(".", "");
                        if (part.IndexOf("3D") == 0)
                        {
                            part = part.Remove(0, 2);
                        }
                        richTextBox1.Text += DesClass.RSADec(part, privKey);

                    }
                }
            }
            else
            {
                bodymail2 = bodymail.Substring(0, k + 2);
                bodymail = bodymail.Remove(0, k + 2);
                if (bodymail2.Length > 3)
                {
                    //  MessageBox.Show(Parts[i]);
                    String part = bodymail2.Replace(".", "");
                    if (part.IndexOf("3D") == 0)
                    {
                        part = part.Remove(0, 2);
                    }
                    richTextBox1.Text += DesClass.RSADec(part, privKey);

                }
            }
            }

            //----------------bodymail;
        }
Example #23
0
        public FormOptions(String Pass)
        {
            InitializeComponent();
            pass = Pass;
            DataTable tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");
            tbl = sql.SelectTable("select S1,S2,W1,W2,L1,L2,P1,P2,SID from MyMail");
            if (tbl.Rows.Count > 0)
            {
                if (tbl.Rows[0][0].ToString().Trim().Length > 0)
                {
                    tbS1.Text = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
                }

                if (tbl.Rows[0][1].ToString().Trim().Length > 0)
                {
                    tbS2.Text = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
                }

                if (tbl.Rows[0][2].ToString().Trim().Length > 0)
                {
                    tbW1.Text = DesClass.Decrypt(tbl.Rows[0][2].ToString().Trim(), pass);
                }

                if (tbl.Rows[0][3].ToString().Trim().Length > 0)
                {
                    tbW2.Text = DesClass.Decrypt(tbl.Rows[0][3].ToString().Trim(), pass);
                }

                if (tbl.Rows[0][4].ToString().Trim().Length > 0)
                {
                    tbL1.Text = DesClass.Decrypt(tbl.Rows[0][4].ToString().Trim(), pass);
                }

                if (tbl.Rows[0][5].ToString().Trim().Length > 0)
                {
                    tbL2.Text = DesClass.Decrypt(tbl.Rows[0][5].ToString().Trim(), pass);
                }

                tbP1.Text = tbl.Rows[0][6].ToString();
                tbP2.Text = tbl.Rows[0][7].ToString();

                if (tbl.Rows[0][8].ToString().Trim().Length > 0)
                {
                    tbSID.Text = tbl.Rows[0][8].ToString().Trim();
                }

                tbl = sql.SelectTable("select name from PubKeySite");
                if (tbl.Rows[0][0].ToString().Trim().Length > 0)
                {
                    tbSite.Text = tbl.Rows[0][0].ToString().Trim();
                }
            }

            string[] files = GetFiles(); string selectLang = "en-EN"; int i = 0;
            try{
            //----lang load

            if (System.IO.File.Exists(@"lang.cfg"))
            {
                string[] lines = System.IO.File.ReadAllLines(@"lang.cfg");
                selectLang = lines[0];
            }
            cbLang.Items.Add("en-EN");

            foreach (string file in files)
            {
               string[] nam = file.Split('.');
               cbLang.Items.Add(nam[0]);
               if (nam[0].IndexOf(selectLang.Trim()) == 0)
               {
                    i = cbLang.Items.Count - 1;
                }

            }
            }
            catch
            {
            MessageBox.Show("Error loading language file!");
            }
            cbLang.SelectedIndex = i;
            //---------------lang

            //----lang load
            /*  string selectLang = "en-EN";
            if (System.IO.File.Exists(@"lang.cfg"))
            {
                string[] lines = System.IO.File.ReadAllLines(@"lang.cfg");
                selectLang = lines[0];
            }*/
            if (selectLang != "en-EN")
            {
                string AssemblyName = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName;
                string pt = Path.GetDirectoryName(AssemblyName);
                string path = pt + @"\lang\" + selectLang.Trim()+".lng";
               if (System.IO.File.Exists(path))
                { string[] lines = System.IO.File.ReadAllLines(path);//--load

                    label1.Text = lines[0];
                    label4.Text = lines[1];
                    label2.Text = lines[2];
                    label6.Text = lines[2];
                    label3.Text = lines[3];
                    label5.Text = lines[3];
                    label7.Text = lines[4];
                    label8.Text = lines[4];
                    label10.Text = lines[5];
                    label11.Text = lines[6];
                    label9.Text = lines[7];
                    label12.Text = lines[8];
                    button1.Text = lines[9];
                    button3.Text = lines[10];
                    button2.Text = lines[11];
                    button4.Text = lines[12];
                    line1 = lines[13];
                    line2 = lines[14];
                    line3 = lines[15];
                    line4 = lines[16];
                }
            }
        }
Example #24
0
        //load header mail
        private void button1_Click(object sender, EventArgs e)
        {
            if (date1.Value > date2.Value)
            {
                MessageBox.Show("ERROR period.");
                return;
            }
            sb = new StringBuilder();
            DataTable tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");
            tbl = sql.SelectTable("select S1,S2,W1,W2,L1,L2,P1,P2 from MyMail");

            if (tbl.Rows[0][0].ToString().Trim().Length > 0)
            {
                S1 = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][1].ToString().Trim().Length > 0)
            {
                S2 = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][2].ToString().Trim().Length > 0)
            {
                W1 = DesClass.Decrypt(tbl.Rows[0][2].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][3].ToString().Trim().Length > 0)
            {
                W2 = DesClass.Decrypt(tbl.Rows[0][3].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][4].ToString().Trim().Length > 0)
            {
                L1 = DesClass.Decrypt(tbl.Rows[0][4].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][5].ToString().Trim().Length > 0)
            {
                L2 = DesClass.Decrypt(tbl.Rows[0][5].ToString().Trim(), pass);
            }

            P1 = tbl.Rows[0][6].ToString();
            P2 = tbl.Rows[0][7].ToString();

            if (S1 == "") { MessageBox.Show("Options failed"); return; }
            Loadheader();
        }
Example #25
0
        private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (listBox1.SelectedIndex == -1)
            {
                return;
            }

            if (e.ClickedItem == contextMenuStrip1.Items[0])//read body mail
            {
                //answer
                if (listBox1.SelectedIndex == -1)
                {
                    return;
                }
                DataTable      tbl = new DataTable();
                SQLLiteconnect sql = new SQLLiteconnect("db.db3");
                tbl = sql.SelectTable("select privkey from MyTable");

                if (tbl.Rows[0][0].ToString().Trim().Length > 0)
                {
                    privKey = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
                }

                int          k  = 0;
                MailObjClass MO = (MailObjClass)listBox1.Items[listBox1.SelectedIndex];
                richTextBox1.Clear();
                richTextBox1.Text += "From: " + MO.Mailfrom + "\r\n";
                richTextBox1.Text += "Date: " + MO.Datesend + "\r\n";
                richTextBox1.Text += "\r\n";
                t  = true;
                sb = new StringBuilder();
                ReadCryptoMail(Convert.ToInt32(MO.Nummail));
                String bodymail2 = "";
                String bodymail  = sb.ToString();
                //richTextBox2.Text = sb.ToString();
                while (bodymail.IndexOf("=") > 0)
                {
                    k = bodymail.IndexOf("==");
                    if (k <= 0)
                    {
                        k = bodymail.IndexOf("=");
                        if (k > 0)
                        {
                            bodymail2 = bodymail.Substring(0, k + 1);
                            bodymail  = bodymail.Remove(0, k + 1);
                            if (bodymail2.Length > 3)
                            {
                                //  MessageBox.Show(Parts[i]);
                                String part = bodymail2.Replace(".", "");
                                if (part.IndexOf("3D") == 0)
                                {
                                    part = part.Remove(0, 2);
                                }
                                richTextBox1.Text += DesClass.RSADec(part, privKey);
                            }
                        }
                    }
                    else
                    {
                        bodymail2 = bodymail.Substring(0, k + 2);
                        bodymail  = bodymail.Remove(0, k + 2);
                        if (bodymail2.Length > 3)
                        {
                            //  MessageBox.Show(Parts[i]);
                            String part = bodymail2.Replace(".", "");
                            if (part.IndexOf("3D") == 0)
                            {
                                part = part.Remove(0, 2);
                            }
                            richTextBox1.Text += DesClass.RSADec(part, privKey);
                        }
                    }
                }

                //----------------bodymail;
                SendMailForm SMF = new SendMailForm(pass, MO.Mailfrom, MO.Datesend + "\r\n" + richTextBox1.Text);

                SMF.ShowDialog();
            }
        }
Example #26
0
        private void button1_Click(object sender, EventArgs e)
        {
            //send
            if (comboBox1.SelectedIndex == -1) { return; }
            ContactClass CC = (ContactClass)comboBox1.Items[comboBox1.SelectedIndex];
            if (CC.Publickey.Trim() == "") { MessageBox.Show(line1); return; }

            DataTable tbl = new DataTable();
            SQLLiteconnect sql = new SQLLiteconnect("db.db3");
            tbl = sql.SelectTable("select S1,S2,W1,W2,L1,L2,P1,P2 from MyMail");

            String S2 = "";
            String L1 = "";
            String L2 = "";
            String W2 = "";
            String P2 = "";

            if (tbl.Rows[0][1].ToString().Trim().Length > 0)
            {
                S2 = DesClass.Decrypt(tbl.Rows[0][1].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][3].ToString().Trim().Length > 0)
            {
                W2 = DesClass.Decrypt(tbl.Rows[0][3].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][4].ToString().Trim().Length > 0)
            {
                L1 = DesClass.Decrypt(tbl.Rows[0][4].ToString().Trim(), pass);
            }

            if (tbl.Rows[0][5].ToString().Trim().Length > 0)
            {
                L2 = DesClass.Decrypt(tbl.Rows[0][5].ToString().Trim(), pass);
            }

            P2 = tbl.Rows[0][7].ToString();

            if (S2 == "") { MessageBox.Show(line2); return; }
            if (W2 == "") { MessageBox.Show(line2); return; }
            if (P2 == "") { MessageBox.Show(line2); return; }
            if (L1 == "") { MessageBox.Show(line2); return; }

            var fromAddress = new MailAddress(L1.Trim(), "");
            string fromPassword = W2.Trim();
            var toAddress = new MailAddress(CC.Mail.Trim(), "");

            const string subject = "Cryptomail";

            richTextBox1.Text+="**************************************************************************************";
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < richTextBox1.Text.Length; i++)
            {
                sb.Append(DesClass.RSAEnc(richTextBox1.Text.Substring(0, 40), CC.Publickey));
                richTextBox1.Text = richTextBox1.Text.Remove(0, 40);
                if (richTextBox1.Text.Length <= 40)
                {
                    sb.Append(DesClass.RSAEnc(richTextBox1.Text, CC.Publickey));
                    break;
                }
            }

            var smtp = new SmtpClient
            {
                Host = S2.Trim(),
                Port = Convert.ToInt32(P2.Trim()),
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials = new System.Net.NetworkCredential(fromAddress.Address, fromPassword)
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = sb.ToString(),
            })

            {
               // message.Headers.Add("X-Message-Flag", "Flagged");
                smtp.Send(message);
            }
            richTextBox1.Text = "";
            MessageBox.Show("OK");
        }
Example #27
0
        private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (listBox1.SelectedIndex == -1) { return; }

            if (e.ClickedItem == contextMenuStrip1.Items[0])//read body mail
            {
                //answer
                if (listBox1.SelectedIndex == -1) { return; }
                DataTable tbl = new DataTable();
                SQLLiteconnect sql = new SQLLiteconnect("db.db3");
                tbl = sql.SelectTable("select privkey from MyTable");

                if (tbl.Rows[0][0].ToString().Trim().Length > 0)
                {
                    privKey = DesClass.Decrypt(tbl.Rows[0][0].ToString().Trim(), pass);
                }

                int k = 0;
                MailObjClass MO = (MailObjClass)listBox1.Items[listBox1.SelectedIndex];
                richTextBox1.Clear();
                richTextBox1.Text += "From: " + MO.Mailfrom + "\r\n";
                richTextBox1.Text += "Date: " + MO.Datesend + "\r\n";
                richTextBox1.Text += "\r\n";
                t = true;
                sb = new StringBuilder();
                ReadCryptoMail(Convert.ToInt32(MO.Nummail));
                String bodymail2 = "";
                String bodymail = sb.ToString();
                //richTextBox2.Text = sb.ToString();
                try{
                while (bodymail.IndexOf("=") > 0)
                {
                    k = bodymail.IndexOf("==");
                    if (k <= 0)
                    {
                        k = bodymail.IndexOf("=");
                        if (k > 0)
                        {
                            bodymail2 = bodymail.Substring(0, k + 1);
                            bodymail = bodymail.Remove(0, k + 1);
                            if (bodymail2.Length > 3)
                            {
                                //  MessageBox.Show(Parts[i]);
                                String part = bodymail2.Replace(".", "");
                                if (part.IndexOf("3D") == 0)
                                {
                                    part = part.Remove(0, 2);
                                }
                                richTextBox1.Text += DesClass.RSADec(part, privKey);

                            }
                        }
                    }
                    else
                    {
                        bodymail2 = bodymail.Substring(0, k + 2);
                        bodymail = bodymail.Remove(0, k + 2);
                        if (bodymail2.Length > 3)
                        {
                            //  MessageBox.Show(Parts[i]);
                            String part = bodymail2.Replace(".", "");
                            if (part.IndexOf("3D") == 0)
                            {
                                part = part.Remove(0, 2);
                            }
                            richTextBox1.Text += DesClass.RSADec(part, privKey);

                        }
                    }
                }

                //----------------bodymail;
                SendMailForm SMF = new SendMailForm(pass, MO.Mailfrom, MO.Datesend + "\r\n" + richTextBox1.Text);
                SMF.ShowDialog();

                }
                catch
                {
                    MessageBox.Show(line1);
                }
            }
        }