Пример #1
0
    protected void btnregister_Click(object sender, EventArgs e)
    {
        try
        {
            objNewCarsInfo.NewCarRequestName = GeneralFunc.ToProper(txtContactName.Text).Trim();
            objNewCarsInfo.NewCarReqPhoneNumber = txtphone.Text;
            objNewCarsInfo.NewCarReqEmail = txtemail.Text;
            DataSet dsNewCarRequest = new DataSet();
            dsNewCarRequest = objNewCarsBl.USP_SaveNewCarRequest(objNewCarsInfo);

            if (dsNewCarRequest.Tables[0].Rows.Count > 0)
            {
                string NewCarName = dsNewCarRequest.Tables[0].Rows[0]["NewCarRequestName"].ToString();
                string Phone = dsNewCarRequest.Tables[0].Rows[0]["NewCarReqPhoneNumber"].ToString();
                string Email = dsNewCarRequest.Tables[0].Rows[0]["NewCarReqEmail"].ToString();
                clsMailFormats format = new clsMailFormats();
                MailMessage msg = new MailMessage();
                msg.From = new MailAddress(CommonVariable.FromInfoMail);

                msg.To.Add(CommonVariable.ContactUsEMail);
                msg.CC.Add(CommonVariable.ContactUsEMailCC);
                msg.Subject = "Regarding new car request";
                msg.IsBodyHtml = true;
                string text = string.Empty;
                text = format.SendNewcarRequestDetails(NewCarName, Phone, Email, ref text);
                msg.Body = text.ToString();
                SmtpClient smtp = new SmtpClient();
                //smtp.Host = "smtp.gmail.com";
                //smtp.Port = 587;
                //smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "hugomirad");
                //smtp.EnableSsl = true;
                //smtp.Send(msg);
                smtp.Host = "127.0.0.1";
                smtp.Port = 25;
                smtp.Send(msg);
            }
            mpealteruser.Show();

        }
        catch (Exception ex)
        {
        }
    }