Esempio n. 1
0
    public bool SendMobileRegistrationRequest(string name, string phonenumber, string email, string AuthenticationID, string CustomerID)
    {
        MobileBL objMobileBL = new MobileBL();
        bool     bSuccess    = false;

        if (CustomerID.Trim() != "")
        {
            string  parameter      = name + "," + phonenumber + "," + email;
            DataSet dsSaveCustInfo = objMobileBL.SaveMobileCustomerInfo("SendMobileRegistrationRequest", CustomerID, AuthenticationID, parameter);
        }

        if (AuthenticationID == ConfigurationManager.AppSettings["AppleID"].ToString())
        {
            NewCarsBl objNewReq = new NewCarsBl();
            try
            {
                string  ReqName         = name.Trim();
                string  ReqPhone        = phonenumber;
                string  ReqEmail        = email;
                DataSet dsNewCarRequest = new DataSet();
                dsNewCarRequest = objNewReq.SaveMobileRegistrationRequest(ReqName, ReqPhone, ReqEmail);

                if (dsNewCarRequest.Tables[0].Rows.Count > 0)
                {
                    string      NewCarName = dsNewCarRequest.Tables[0].Rows[0]["MobileRegReqName"].ToString();
                    string      Phone      = dsNewCarRequest.Tables[0].Rows[0]["MobileRegReqPhone"].ToString();
                    string      Email      = dsNewCarRequest.Tables[0].Rows[0]["MobileRegReqEmail"].ToString();
                    MailFormats format     = new MailFormats();
                    MailMessage msg        = new MailMessage();
                    msg.From = new MailAddress("*****@*****.**");

                    msg.To.Add("*****@*****.**");
                    // msg.CC.Add("*****@*****.**");
                    msg.Subject    = "Regarding  mobile registration request";
                    msg.IsBodyHtml = true;
                    string text = string.Empty;
                    text     = format.SendNewRegistrationRequestDetails(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("*****@*****.**", "sob902290");
                    //smtp.EnableSsl = true;
                    //smtp.Send(msg);
                    smtp.Host = "127.0.0.1";
                    smtp.Port = 25;
                    smtp.Send(msg);

                    bSuccess = true;
                }
            }
            catch (Exception ex)
            {
            }
        }


        return(bSuccess);
    }
Esempio n. 2
0
    public bool SendMobileRegistrationRequest(string name, string phonenumber, string email, string AuthenticationID, string CustomerID)
    {
        MobileBL objMobileBL = new MobileBL();
        bool bSuccess = false;

        if (CustomerID.Trim() != "")
        {
            string parameter = name + "," + phonenumber + "," + email;
            DataSet dsSaveCustInfo = objMobileBL.SaveMobileCustomerInfo("SendMobileRegistrationRequest", CustomerID,AuthenticationID,parameter);
        }

        if (AuthenticationID == ConfigurationManager.AppSettings["AppleID"].ToString())
        {
            NewCarsBl objNewReq = new NewCarsBl();
            try
            {
                string ReqName = name.Trim();
                string ReqPhone = phonenumber;
                string ReqEmail = email;
                DataSet dsNewCarRequest = new DataSet();
                dsNewCarRequest = objNewReq.SaveMobileRegistrationRequest(ReqName, ReqPhone, ReqEmail);

                if (dsNewCarRequest.Tables[0].Rows.Count > 0)
                {
                    string NewCarName = dsNewCarRequest.Tables[0].Rows[0]["MobileRegReqName"].ToString();
                    string Phone = dsNewCarRequest.Tables[0].Rows[0]["MobileRegReqPhone"].ToString();
                    string Email = dsNewCarRequest.Tables[0].Rows[0]["MobileRegReqEmail"].ToString();

                    if (Email == "")
                    {
                        Email = System.Configuration.ConfigurationSettings.AppSettings["From"].ToString();
                    }

                    MailFormats format = new MailFormats();
                    MailMessage msg = new MailMessage();
                    msg.From = new MailAddress(Email);

                    msg.To.Add(System.Configuration.ConfigurationSettings.AppSettings["To"].ToString());
                    msg.CC.Add(System.Configuration.ConfigurationSettings.AppSettings["CC"].ToString());
                    msg.Subject = "Regarding  mobile registration request";
                    msg.IsBodyHtml = true;
                    string text = string.Empty;
                    text = format.SendNewRegistrationRequestDetails(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("*****@*****.**", "sob902290");
                    //smtp.EnableSsl = true;
                    //smtp.Send(msg);
                    smtp.Host = "127.0.0.1";
                    smtp.Port = 25;
                    smtp.Send(msg);

                    bSuccess = true;
                }
            }
            catch (Exception ex)
            {
            }

        }

        return bSuccess;
    }