示例#1
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        if (Validate())
        {
            Hashtable tbIn = new Hashtable();
            tbIn.Add("Member_Status", "1");
            tbIn.Add("Member_Phone", phone.Text);
            tbIn.Add("Member_Email", email.Text);
            tbIn.Add("Member_Password", ApplicationUtil.PasswordEncrypt(CMSfunc._Replate(password.Text)));
            var res = UpdateData.Insert("tbl_Member", tbIn);
            if (res)
            {
                dvsuccess.Visible = true;
                lbError.Text      = "Đăng ký thành công! Bạn có thể <a href='/login.htm' class='text-bold'>Đăng nhập.</a>";
                string fromEmail = email.Text;
                string toEmail   = email.Text;
                string Name      = CMSfunc._GetConst("_Name");

                string Subject         = "ĐĂNG KÝ TÀI KHOẢN THÀNH CÔNG TẠI " + CMSfunc._GetConst("_Domain");
                string Host            = CMSfunc._GetConst("_Hostmail");
                string EmailClient     = CMSfunc._GetConst("_EmailClient");
                string PassEmailClient = CMSfunc._GetConst("_PassEmailClient");
                int    Port            = Convert.ToInt32(CMSfunc._GetConst("_Port"));
                string strBody         = "<html><body><p><b>Quý khách đăng ký thành công tài khoản tại website " + CMSfunc._GetConst("_Domain") + "</b></p><p><b>Thông tin tài khoản: </b></p><p>&nbsp;&nbsp;&nbsp;+ Số điện thoại: " + phone.Text + "</p><p>&nbsp;&nbsp;&nbsp;+ Mật khẩu: " + password.Text + "</p><p>Quý khách vui lòng truy cập " + CMSfunc._GetConst("_Domain") + " chọn Đăng nhập để đặt vé xe điện tử. <br>Cảm ơn quý khách đã sử dụng dịch vụ của chúng tôi.</p></body></html>";
                try
                {
                    bool _isSend = SendMailClient.SendGMail(toEmail, fromEmail, Name, "", Subject, Host, Port, EmailClient, PassEmailClient, "Xác thực thành công", strBody);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
        }
    }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            call            = new InstanceContext(new SendMailCallback(this));
            mailMessage     = new MailMessage();
            _SendMailClient = new SendMailClient(call);

            mailMessage.FromAddress = "*****@*****.**";
            mailMessage.Subject     = "analisis de WCF";
            mailMessage.ToAddress   = "*****@*****.**";
            _SendMailClient.SubmitMessage(mailMessage);
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
           call = new InstanceContext(new SendMailCallback(this));
            mailMessage = new MailMessage();
            _SendMailClient = new SendMailClient(call);

            mailMessage.FromAddress = "*****@*****.**";
            mailMessage.Subject = "analisis de WCF";
            mailMessage.ToAddress = "*****@*****.**";
            _SendMailClient.SubmitMessage(mailMessage);
            
        }
 private void OnSendMail()
 {
     try
     {
         using (var client = new SendMailClient())
         {
             client.SubmitMessage(MainMailMessage);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#5
0
    protected void btnPassword_Click(object sender, EventArgs e)
    {
        Div1.Visible = false;
        if (string.IsNullOrEmpty(email.Text))
        {
            display            = "";
            alertType          = "danger";
            lberror_email.Text = "Bạn phải nhập email";
        }
        else
        {
            var members = new MemberRepository().SearchFor(o => o.Member_Email == email.Text);
            if (members == null || members.Count() == 0)
            {
                dverror_email.Visible = true;
                lberror_email.Text    = "Email không thuộc về bất kỳ tài khoản nào, vui lòng kiểm tra lại.";
            }
            else
            {
                var        newpass = Value.CreatePassword(6);
                tbl_Member member  = members.SingleOrDefault();
                Hashtable  tb      = new Hashtable();
                tb.Add("Member_Password", ApplicationUtil.PasswordEncrypt(newpass));
                if (UpdateData.Update("tbl_Member", tb, "Member_ID=" + member.Member_ID))
                {
                    #region Send Mail
                    //send mail
                    string strBody = "<html><body>\n";
                    strBody += "<h2>Chào mừng đến với " + CMSfunc._GetConst("_Domain") + "</h1><br>\n";
                    strBody += "Mật khẩu mới của quý khách là: <strong style='color: red'>" + newpass + "</strong><br>\n";
                    strBody += "</body></html>";

                    string fromEmail = CMSfunc._GetConst("_EmailClient");
                    string toEmail   = email.Text;
                    string Name      = CMSfunc._GetConst("_Name");

                    string Subject         = "THAY ĐỔI MẬT KHẨU ĐĂNG NHẬP";
                    string Host            = CMSfunc._GetConst("_Hostmail");
                    string EmailClient     = CMSfunc._GetConst("_EmailClient");
                    string PassEmailClient = CMSfunc._GetConst("_PassEmailClient");
                    int    Port            = Convert.ToInt32(CMSfunc._GetConst("_Port"));
                    try
                    {
                        bool _isSend = SendMailClient.SendGMail(toEmail, fromEmail, Name, "", Subject, Host, Port, EmailClient, PassEmailClient, "Xác thực thành công", strBody);
                        if (_isSend)
                        {
                            Div1.Visible   = false;
                            Div2.Visible   = true;
                            lbSuccess.Text = "Thay đổi mật khẩu thành công, mật khẩu mới đã được gửi về Email của bạn. Vui lòng kiểm tra email và đăng nhập lại.";
                        }
                        else
                        {
                            Div2.Visible = false;
                            Div1.Visible = true;
                            lbError.Text = "Thay đổi mật khẩu không thành công, vui lòng thử lại.";
                        }
                    }
                    catch (Exception ex)
                    {
                        Div2.Visible = false;
                        Div1.Visible = true;
                        lbError.Text = "Thay đổi mật khẩu không thành công, vui lòng thử lại.";
                    }
                    #endregion
                }
            }
        }
    }