| Server IP : 104.21.93.206  /  Your IP : 108.162.241.225 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;
public partial class prevention : 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_Prevention", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = txtname.Text;
      
        cmd.Parameters.Add("@phone", SqlDbType.NVarChar).Value = txtmobile.Text;
        cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value = txtemail.Text;
        cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = txtsubject.Text;
        cmd.Parameters.Add("@message", SqlDbType.NVarChar).Value = txtmemo.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]	", "Complaint", System.Text.Encoding.UTF8);
        mail.Subject = "Complaint from " + txtname.Text;
        mail.SubjectEncoding = System.Text.Encoding.UTF8;
        mail.Body = "Complaint from " + txtname.Text + " <br> Name : " + txtname.Text + "<br> Email Name : " + txtemail.Text + "<br> Mobile : " + txtmobile.Text + "<br> Subject : " + txtsubject.Text + "<br> Message : " + txtmemo.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(txtemail.Text);
        mail2.From = new MailAddress("[email protected]	", "Complaint", System.Text.Encoding.UTF8);
        mail2.Subject = "Reply from PIMS";
        mail2.SubjectEncoding = System.Text.Encoding.UTF8;
        mail2.Body = "Thanks for write 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>");
        }
    } 
}