Esempio n. 1
0
 protected void btnsend_Click(object sender, EventArgs e)
 {
     if (txtEmail.Text != "" && txtMessege.Text != "" && txtSubject.Text != "")
     {
         mail m = new mail();
         if (m.SendMail(txtEmail.Text, txtSubject.Text, txtMessege.Text))
         {
             lblResult.Text  = "Messege Send.";
             txtSubject.Text = "";
             txtMessege.Text = "";
             txtEmail.Text   = "";
         }
         else
         {
             lblResult.Text  = "Messege Not Send.";
             txtSubject.Text = "";
             txtMessege.Text = "";
             txtEmail.Text   = "";
         }
     }
     else
     {
         lblResult.Text = "Fill all Froms.";
     }
 }
Esempio n. 2
0
        public ActionResult Forgot(username model)
        {
            username fforgot = _db.usernames.Where(p => p.mail.Equals(model.mail)).SingleOrDefault();

            if (fforgot != null)
            {
                Session["email"] = fforgot.mail;
                Session["name"]  = fforgot.name;
                Session["pass"]  = fforgot.password_;

                string title, body;
                string main   = "on";
                bool   result = false;
                if (main == "on")
                {
                    title  = "Columba - Password Reminder";
                    body   = "Hi, <br><br>" + Session["name"].ToString().ToUpper() + ", <br/><br/>Your password is: " + Session["pass"];
                    result = newItem.SendMail(Session["email"].ToString(), title, body);

                    if (result == true)
                    {
                        ViewBag.issuccess = true;
                    }
                    else
                    {
                        ViewBag.issuccess = false;
                    }
                }
                return(View());
            }
            else
            {
                ViewBag.issuccess = false;
            }

            return(View());
        }