public void SendSMS(string id, string name, string sponserID, string mob, string pass, string email, string username, string Cust_Password, string Cust_Package) { try { string Cust_Package_amt; //Cust_Package_amt = conCls.getScalerValue("select Product_Price from Product_chart where Product_Code ='" + Cust_Package + "'"); Cust_Package_amt = "0"; WebClient client = new WebClient(); DataSet ds = new DataSet(); ds = conCls.getdataSet("select Baseurl1,Baseurl2 from SMS_Services where Status=1"); DataTable dt = ds.Tables[0]; if (dt != null) { if (dt.Rows.Count > 0) { string baseurl = dt.Rows[0][0].ToString() + mob + dt.Rows[0][1].ToString() + "Congratulations! Dear " + name + ",Thanks For Joining With Us Your userName (" + username + ") and Password: "******" - trans pws :" + pass + " with amount " + Cust_Package_amt + " for detail pls visit aps-mining.com"; Stream data = client.OpenRead(baseurl); StreamReader reader = new StreamReader(data); string s = reader.ReadToEnd(); data.Close(); reader.Close(); } } ds.Dispose(); var mailbody = new MailVerifyPopulatedBody(); string body = mailbody.PopulateBody(id, name, sponserID, mob, pass, email, username, Cust_Password); DateTime letterdt = ConnectionCls.getIndianDateTime(); string dat = letterdt.ToShortDateString(); var toAddress = email; string subject = "Verification Mail from aps-mining "; MailMessage mailMsg = new MailMessage(); // To mailMsg.To.Add(new MailAddress(email)); // From mailMsg.From = new MailAddress("*****@*****.**", "Email Verification"); // Subject and multipart/alternative Body mailMsg.Subject = subject; string text = "text body"; string html = body; mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(text, null, MediaTypeNames.Text.Plain)); mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html)); SmtpClient smtpClient1 = new SmtpClient("smtp.mailgun.org", Convert.ToInt32(587)); smtpClient1.EnableSsl = true; System.Net.NetworkCredential credentials1 = new System.Net.NetworkCredential("*****@*****.**", "b5fe91c3d559323d663987a96d22fbcf"); smtpClient1.Credentials = credentials1; smtpClient1.Send(mailMsg); } catch (Exception) { throw; } }
private void SendSMS(string id, string name, string email, string username) { try { string body = this.PopulateBody(id, name, email, username); DateTime letterdt = ConnectionCls.getIndianDateTime(); string dat = letterdt.ToShortDateString(); // Gmail Address from where you send the mail var fromAddress = "*****@*****.**"; // any address where the email will be sending var toAddress = email; //Password of your gmail address const string fromPassword = "******"; // Passing the values and make a email formate to display //string subject = "aps-mining.com Welcome to website...!"; string subject = "Registration aps-mining.com"; // body = bodyy; MailMessage mailMsg = new MailMessage(); // To mailMsg.To.Add(new MailAddress(email)); // From //mailMsg.From = new MailAddress("*****@*****.**", " Registration Detail"); mailMsg.From = new MailAddress("*****@*****.**", " Registration"); // Subject and multipart/alternative Body mailMsg.Subject = subject; string text = "text body"; string html = body; mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(text, null, MediaTypeNames.Text.Plain)); mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html)); // Init SmtpClient and send SmtpClient smtpClient = new SmtpClient("smtp.mailgun.org", Convert.ToInt32(587)); smtpClient.EnableSsl = true; System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("*****@*****.**", "b5fe91c3d559323d663987a96d22fbcf"); smtpClient.Credentials = credentials; smtpClient.Send(mailMsg); // sending mail to sponsor string sp_cusid = ""; string sp_cus_name = ""; string sp_cus_email = ""; string sp_cus_username = ""; string sp_cus_sponsorid = ""; SqlDataReader sdr12 = conCls.GetdataReader("select Cust_SponserID from custrecords where cusid =" + id.ToString()); if (sdr12.HasRows) { if (sdr12.Read()) { sp_cus_sponsorid = sdr12["Cust_SponserID"].ToString(); } } sdr12.Close(); sdr12.Dispose(); SqlDataReader sdr11 = conCls.GetdataReader("select cusid, cust_name, cust_username, email from custrecords where cusid =" + sp_cus_sponsorid.ToString()); if (sdr11.HasRows) { if (sdr11.Read()) { //sss = Int32.Parse(sdr11[0].ToString()); try { sp_cusid = sdr11["cusid"].ToString(); sp_cus_name = sdr11["cust_name"].ToString(); sp_cus_username = sdr11["cust_username"].ToString(); sp_cus_email = sdr11["email"].ToString(); } catch { } } } sdr11.Close(); sdr11.Dispose(); //id, name, email, username string sp_name = ""; //string body_sponsor = this.PopulateBody_sponsor(sp_cusid, sp_cus_name, sp_cus_email, sp_cus_username, sp_name); string body_sponsor = this.PopulateBody_sponsor(sp_cusid, name, email, username, sp_name); DateTime letterdt_sponsor = ConnectionCls.getIndianDateTime(); string date_sponsor = letterdt.ToShortDateString(); // Gmail Address from where you send the mail var fromAddress_sponsor = "*****@*****.**"; // any address where the email will be sending var toAddress_sponsor = sp_cus_email; //Password of your gmail address const string fromPassword_sponsor = "b5fe91c3d559323d663987a96d22fbcf"; // Passing the values and make a email formate to display //string subject = "aps-mining.com Welcome to website...!"; string subject_sponsor = "Great Job..." + sp_cus_name + ", " + name + " just signed up as your direct referral in your team"; // body = bodyy; MailMessage mailMsg_sponsor = new MailMessage(); // To mailMsg_sponsor.To.Add(new MailAddress(toAddress_sponsor)); // From //mailMsg.From = new MailAddress("*****@*****.**", " Registration Detail"); mailMsg_sponsor.From = new MailAddress("*****@*****.**", subject_sponsor.ToString()); // Subject and multipart/alternative Body mailMsg_sponsor.Subject = subject_sponsor; string text_sponsor = "text body"; string html_sponsor = body_sponsor; mailMsg_sponsor.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(text_sponsor, null, MediaTypeNames.Text.Plain)); mailMsg_sponsor.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(html_sponsor, null, MediaTypeNames.Text.Html)); // Init SmtpClient and send SmtpClient smtpClient_sponsor = new SmtpClient("smtp.mailgun.org", Convert.ToInt32(587)); smtpClient_sponsor.EnableSsl = true; System.Net.NetworkCredential credentials_sponsor = new System.Net.NetworkCredential("*****@*****.**", "b5fe91c3d559323d663987a96d22fbcf"); smtpClient_sponsor.Credentials = credentials_sponsor; smtpClient_sponsor.Send(mailMsg_sponsor); //SMTP Server: smtp-pulse.com //Port: 2525 (SSL port: 465) //Login: [email protected] //Password: 06526edd28b7ec716cc2bef941cb0587 Change password //Your IP: 78.41.200.13 //Sender Email: [email protected] } catch (Exception ex) { } }
private void SendSMS(string id, string name, string sponserID, string mob, string pass, string email, string username, string Cust_Password, string Cust_Package) { try { int flag = 0; string errmsg = ""; string otp = ""; string Type = "Registration"; string Cust_Package_amt; //Cust_Package_amt = conCls.getScalerValue("select Product_Price from Product_chart where Product_Code ='" + Cust_Package + "'"); Cust_Package_amt = "0"; WebClient client = new WebClient(); DataSet ds = new DataSet(); ds = conCls.getdataSet("select Baseurl1,Baseurl2 from SMS_Services where Status=1"); DataTable dt = ds.Tables[0]; if (dt != null) { if (dt.Rows.Count > 0) { string baseurl = dt.Rows[0][0].ToString() + mob + dt.Rows[0][1].ToString() + "Congratulations! Dear " + name + ",Thanks For Joining With Us Your userName (" + username + ") and Password: "******" - trans pws :" + pass + " with amount " + Cust_Package_amt + " for detail pls visit aps-mining.com"; Stream data = client.OpenRead(baseurl); StreamReader reader = new StreamReader(data); string s = reader.ReadToEnd(); data.Close(); reader.Close(); } } ds.Dispose(); conCls.Insert_OTP_Code(id, Type, out flag, out errmsg, out otp); if (flag == 1) { string body = this.PopulateBody1(id, name, sponserID, mob, pass, email, username, Cust_Password, otp); DateTime letterdt = ConnectionCls.getIndianDateTime(); string dat = letterdt.ToShortDateString(); // Gmail Address from where you send the mail //var fromAddress = ConfigurationManager.AppSettings["smtpsenderEmail"].ToString(); // any address where the email will be sending var toAddress = email; //Password of your gmail address //string fromPassword = ConfigurationManager.AppSettings["smtpPassword"].ToString(); // Passing the values and make a email formate to display //string subject = "aps-mining.com Welcome to website...!"; string subject = "Verification Mail from stack miner"; // body = bodyy; MailMessage mailMsg = new MailMessage(); // To mailMsg.To.Add(new MailAddress(email)); // From mailMsg.From = new MailAddress("*****@*****.**", "Email Verification"); //mailMsg.From = new MailAddress("*****@*****.**", " Registration Detail"); //mailMsg.From = new MailAddress(ConfigurationManager.AppSettings["smtpsenderEmail"].ToString(), "Email Verification - aps-mining Pool "); // Subject and multipart/alternative Body mailMsg.Subject = subject; string text = "text body"; string html = body; mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(text, null, MediaTypeNames.Text.Plain)); mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html)); // Init SmtpClient and send SmtpClient smtpClient1 = new SmtpClient("smtp.mailgun.org", Convert.ToInt32(587)); smtpClient1.EnableSsl = true; System.Net.NetworkCredential credentials1 = new System.Net.NetworkCredential("*****@*****.**", "b5fe91c3d559323d663987a96d22fbcf"); smtpClient1.Credentials = credentials1; smtpClient1.Send(mailMsg); } else { } } catch (Exception) { throw; } }