| Server IP : 172.67.214.117  /  Your IP : 172.69.214.235 Web Server : Microsoft-IIS/10.0 System : Windows NT WAVE 10.0 build 20348 (Windows Server 2016) AMD64 User : IWPD_458(indias) ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/inetpub/vhosts/indiasmartbazaar.com/pimsharyana.in/ | 
| Upload File : | 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Net.Mail;
using System.Net;
public partial class registration_online : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString);
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        SqlCommand cmd = new SqlCommand("SP_registration", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = txtname.Text;
        cmd.Parameters.Add("@father_name", SqlDbType.NVarChar).Value = TextBox1.Text;
        cmd.Parameters.Add("@mobile", SqlDbType.NVarChar).Value = TextBox2.Text;
        cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value = TextBox3.Text;
        cmd.Parameters.Add("@remarks", SqlDbType.NVarChar).Value = remarks.Text;
        cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = txtaddress.Text;
        con.Open();
        int RA = cmd.ExecuteNonQuery();
        con.Close();
        if (RA > 0)
        {
            lblsucess.Visible = true;
        }
        else
        {
            lblfailed.Visible = true;
        }
        MailMessage mail = new MailMessage();
        mail.To.Add("[email protected]");
        mail.From = new MailAddress("[email protected]	", "Enquiry", System.Text.Encoding.UTF8);
        mail.Subject = "Enquiry from " + txtname.Text;
        mail.SubjectEncoding = System.Text.Encoding.UTF8;
        mail.Body = "Enquiry Request from " + txtname.Text + " <br> Name : " + txtname.Text + "<br> Father Name : " + TextBox1.Text + "<br> Mobile : " + TextBox2.Text + "<br> Email : " + TextBox3.Text + "<br> Remarks : " + remarks.Text + "<br> Address : " + txtaddress.Text;
        mail.BodyEncoding = System.Text.Encoding.UTF8;
        mail.IsBodyHtml = true;
        mail.Priority = MailPriority.High;
        SmtpClient client = new SmtpClient();
        client.Credentials = new System.Net.NetworkCredential("[email protected]", "Urmylifeak@123");
        client.Port = 25;
        client.Host = "Mail5008.site4now.net";
        try
        {
            client.Send(mail);
            //lblsucess.Visible = true;
            //Page.RegisterStartupScript("UserMsg", "<script>alert('Successfully Send...');if(alert){ window.location='SendMail.aspx';}</script>");
        }
        catch (Exception ex)
        {
            Exception ex2 = ex;
            string errorMessage = string.Empty;
            while (ex2 != null)
            {
                errorMessage += ex2.ToString();
                ex2 = ex2.InnerException;
            }
            //Page.RegisterStartupScript("UserMsg", "<script>alert('Sending Failed...');if(alert){ window.location='SendMail.aspx';}</script>");
        }
        //Mail 2
        MailMessage mail2 = new MailMessage();
        mail2.To.Add(TextBox3.Text);
        mail2.From = new MailAddress("[email protected]	", "Enquiry", System.Text.Encoding.UTF8);
        mail2.Subject = "Reply from PIMS";
        mail2.SubjectEncoding = System.Text.Encoding.UTF8;
        mail2.Body = "Thanks for contact Us! We will contact you As soon as Possible";
        mail2.BodyEncoding = System.Text.Encoding.UTF8;
        mail2.IsBodyHtml = true;
        mail2.Priority = MailPriority.High;
        SmtpClient client2 = new SmtpClient();
        client2.Credentials = new System.Net.NetworkCredential("[email protected]", "Urmylifeak@123");
        client2.Port = 25;
        client2.Host = "Mail5008.site4now.net";
        try
        {
            client2.Send(mail2);
            //lblsucess.Visible = true;
            //Page.RegisterStartupScript("UserMsg", "<script>alert('Successfully Send...');if(alert){ window.location='SendMail.aspx';}</script>");
        }
        catch (Exception ex)
        {
            Exception ex2 = ex;
            string errorMessage = string.Empty;
            while (ex2 != null)
            {
                errorMessage += ex2.ToString();
                ex2 = ex2.InnerException;
            }
            //Page.RegisterStartupScript("UserMsg", "<script>alert('Sending Failed...');if(alert){ window.location='SendMail.aspx';}</script>");
        }
    }
}