示例#1
0
        public void SendMailTest()
        {
            // Create layer that logs messages in list instead of actually sending them
            List <MailMessage> messages = new List <MailMessage>();
            ITestMail          mail     = MailAccessLayer.Create <ITestMail>(messages.Add);

            mail.SendAlert("TEST PASSED", "*****@*****.**");
            Assert.AreEqual(1, messages.Count);

            mail.SendNewsletter("*****@*****.**", "Buy more goods!");
            Assert.AreEqual(2, messages.Count);

            Assert.AreSame(mail.GetType(), MailAccessLayer.Implement(typeof(ITestMail)));
        }
        protected void btnchangepasword_Click(object sender, EventArgs e)
        {
            try
            {
                string no   = "";
                string name = "";
                var    q    = objlogin.ForgotPassword(txtuserid.Value);
                if (q.Any())
                {
                    string Password = Guid.NewGuid().ToString().Substring(0, 10);

                    foreach (tblreg k in q)
                    {
                        no = Convert.ToInt64(k.ContactNo).ToString();

                        name = k.Name;
                    }
                    string filepath = Server.MapPath("Forget.html");
                    string datetime = DateTime.Now.ToString();
                    string year     = DateTime.Now.Year.ToString();

                    int Issuccess = MailAccessLayer.ForgotPassword(txtuserid.Value, name, name, no, datetime, filepath, year, Password);
                    if (Issuccess == 1)
                    {
                        Editlayer.PasswordChangeOnEmail(txtuserid.Value, Password);
                        lblmsg.Text = "Mail has been send successfully ...";
                    }
                    else
                    {
                        lblmsg.Text = "Technical Error Please try again later...";
                    }

                    lblmsg.Visible = true;
                    lblmsg.Focus();
                }
                else
                {
                    lblmsg.Text = "Please Enter a Valid Email-Id...";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
 protected void btnsubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string filepath   = Server.MapPath("~/Admin/MailBody.html");
         string name       = txtname.Value;
         string mail       = txtmail.Value;
         string contactno  = txtno.Value;
         string contactmsg = txtmsg.Value;
         string datetime   = DateTime.Now.ToString();
         string year       = DateTime.Now.Year.ToString();
         MailAccessLayer.SendContactMail(mail, name, contactno, datetime, filepath, year, contactmsg);
         ContactUs();
         lblmsg.Visible = true;
         lblmsg.Focus();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#4
0
 protected void btnsubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string filepath  = Server.MapPath("ReplyFeedback.html");
         string name      = txtname.Value;
         string mail      = txtemail.Value;
         string contactno = txtcontact.Value;
         string replymsg  = txtrply.Value;
         string datetime  = DateTime.Now.ToString();
         string year      = DateTime.Now.Year.ToString();
         MailAccessLayer.Sendfeedbackmail(mail, name, contactno, datetime, filepath, year, replymsg);
         rply();
         lblmsg.Visible = true;
         lblmsg.Focus();
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
     }
 }