protected void Email(string txtTo, string Data) { SendEmail1 s = new SendEmail1(); s.sendEMail(txtTo.Trim(), Data.Trim()); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", "alert('Mail has been sent successfully. .');", true); }
protected void btnsend_Click(object sender, EventArgs e) { StudentRegistrationDAL SDAL = new StudentRegistrationDAL(); try { string date1 = DateTime.Today.ToString("yyyyMMdd"); string[] attachment = new string[1]; if (chkcoec.Checked == true) { attachment = new string[1]; attachment[0] = Server.MapPath("~\\TempFiles\\" + date1 + "\\" + ddlTerm.SelectedItem.Text + "-Consolidated-Overall.pdf"); attlength = 1; } else { attachment = new string[5]; attachment[0] = Server.MapPath("~\\TempFiles\\" + date1 + "\\" + ddlTerm.SelectedItem.Text + "-BBA-Weekday.pdf"); attachment[1] = Server.MapPath("~\\TempFiles\\" + date1 + "\\" + ddlTerm.SelectedItem.Text + "-BBA-Weekend.pdf"); attachment[2] = Server.MapPath("~\\TempFiles\\" + date1 + "\\" + ddlTerm.SelectedItem.Text + "-MBA-Weekday.pdf"); attachment[3] = Server.MapPath("~\\TempFiles\\" + date1 + "\\" + ddlTerm.SelectedItem.Text + "-MBA-Weekend.pdf"); // attachment[4] = Server.MapPath("~\\TempFiles\\" + ddlTerm.SelectedItem.Text + "-Consolidated-Nationality-Wise.pdf"); attachment[4] = Server.MapPath("~\\TempFiles\\" + date1 + "\\" + ddlTerm.SelectedItem.Text + "-Consolidated-Comparatitive-Enrollment-Statistics.pdf"); attlength = 5; } string CC = ""; string to = txtTo.Text.Replace(";", ", "); if (txtCC.Text == "") { CC = ""; } else { CC = txtCC.Text.Replace(";", ", "); } string subject = txtSubject.Text; string body = editor.Content; bool IsSent = SendEmail1.SendEmailwithAttach("*****@*****.**", to, subject, body, CC, attachment, attlength); if (IsSent) { int count = SDAL.SaveEmailSendingLog(to, "*****@*****.**", subject, body, Convert.ToInt32(Session["EmpId"].ToString()), "INSERT", txtCC.ToString()); ClearData(); ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Email sent successfully with all the reports.');", true); } else { lblMesag.Text = "Please try again later...!"; lblMesag.ForeColor = System.Drawing.Color.Red; } } catch { lblmess.Text = "Close PDF or Try Again"; pnlview.Visible = false; } }
private void checkForPreviousEntry() { try { if (conn.State != ConnectionState.Open) { conn.Open(); } string checkuser = "******"; cmd = new SqlCommand(checkuser, conn); cmd.Parameters.AddWithValue("@uid", Session["uid"]); cmd.Parameters.AddWithValue("@eid", Request.QueryString["eid"]); string temp = (cmd.ExecuteScalar().ToString()); conn.Close(); if (temp == "1") { string display = "you have already booked this event"; ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + display + "');", true); } else { int bookingid = bookevent(); SendEmail1 s = new SendEmail1(); string msg = Convert.ToString("<br />You have been booked for an event in our Web site <br/>Your Booking Reference ID: <b>" + DateTime.Now.Year + "" + DateTime.Now.Month + "" + DateTime.Now.Day + "AP" + Convert.ToString(bookingid) + "</b><br /><br />"); s.sendEMail(Convert.ToString(Session["uemail"]), "Event", msg); Response.Redirect("BookedEvents.aspx"); } } catch (Exception ex) { Response.Redirect("error.aspx"); // throw ex; } }
protected void submit_Click(object sender, EventArgs e) { Name = txtname.Text; Pmsg = txtmsg.Text; Subject = "Contact:- " + TextBox2.Text; Email = txtemail.Text; NMsg = "From Mr." + Name + "<br/><br/>" + "Email: " + Email + "<br/><br/>" + "Message : " + Pmsg; SendEmail1 a = new SendEmail1(); a.SendEmail(Subject, NMsg); }
protected void btnSendSMS_Click(object sender, EventArgs e) { try { SMSCAPI obj = new SMSCAPI(); string strPostResponse; StudentRegistrationDAL d = new StudentRegistrationDAL(); //strPostResponse = obj.SendSMS("", "", "+" + d.GetCheckMobileContact(Request.QueryString["LinkId"].ToString()), "Dear Student, The result of the placement exam is published and can be checked through the student portal."); SendEmail1.SendEmail("*****@*****.**", d.GetCheckMailContact(Request.QueryString["LinkId"].ToString()), "Placement Result", "Dear Student, The result of the placement exam is published and can be checked through the student portal.", ""); } catch { } }
protected void btnsend_Click(object sender, EventArgs e) { StudentRegistrationDAL SDAL = new StudentRegistrationDAL(); try { string[] attachment = new string[1]; attachment = new string[2]; attachment[0] = Server.MapPath("~\\TempFiles\\" + getdateformat(txtFromDate.Text) + "-" + getdateformat(txtToDate.Text) + "-Consolidated-DaterangeCMS.pdf"); attachment[1] = Server.MapPath("~\\TempFiles\\" + getdateformat(Txtcmsdate.Text) + "-Consolidated-CMS.pdf"); attlength = 2; string CC = ""; string to = txtTo.Text.Replace(";", ", "); if (txtCC.Text == "") { CC = ""; } else { CC = txtCC.Text.Replace(";", ", "); } string subject = txtSubject.Text; string body = editor.Content; bool IsSent = SendEmail1.SendEmailwithAttach("*****@*****.**", to, subject, body, CC, attachment, attlength); if (IsSent) { int count = SDAL.SaveEmailSendingLog(to, "*****@*****.**", subject, body, Convert.ToInt32(Session["EmpId"].ToString()), "INSERT", txtCC.ToString()); ClearData(); ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Email sent successfully with all the reports.');", true); } else { lblMesag.Text = "Please try again later...!"; lblMesag.ForeColor = System.Drawing.Color.Red; } } catch { lblmess.Text = "Close PDF or Try Again"; pnlview.Visible = false; } }
protected void Button1_Click(object sender, EventArgs e) { if (FileImage.HasFile) { string extension = (string)Path.GetExtension(FileImage.FileName); if (extension == ".jpg" || extension == ".png" || extension == ".jpeg" || extension == ".gif" || extension == ".bmp") { string s = ("~/Error Screenshot/" + FileImage.FileName).ToString(); FileImage.SaveAs(Server.MapPath(s)); lblStatus.Visible = true; lblStatus.ForeColor = System.Drawing.Color.Blue; lblStatus.Text = "Email Sent"; imgProduct.Visible = true; imgProduct.ImageUrl = "~/Error Screenshot/" + FileImage.FileName; SendEmail se = new SendEmail(); string msg = "This is a new Error that the user is facing reported by " + (string)Session["Email"] + " Description Of the Error: " + TextBox1.Text; SqlCommand cmd = con.CreateCommand(); cmd.CommandText = "Select Admin_email_id from Admin"; DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); foreach (DataRow dr in dt.Rows) { string email = (string)dr["Admin_email_id"]; se.sendEMail(email, msg, "E:\\Project\\CMSW\\Error Screenshot\\" + FileImage.FileName); } SendEmail1 sq = new SendEmail1(); string mess = "We have Acknowledged Your Request Thank You For Reporting We will Get Back To You as Soon as possible " + (string)Session["Name"]; sq.sendEMail((string)Session["Email"], mess); } else { imgProduct.Visible = false; lblStatus.Visible = true; lblStatus.Text = "Please Upload Correct Format File"; } } else { imgProduct.Visible = false; lblStatus.Visible = true; lblStatus.Text = "Please Upload Image File"; } }
protected void btnConfirm_Click(object sender, EventArgs e) { try { Object orderSummaryID = saveOrderSummaryWithClient(); SaveOrderDetails(orderSummaryID); SendEmail1 s = new SendEmail1(); s.sendEMail(Convert.ToString(Session["Email"]), Convert.ToString(Session["OrderSummary"]) + "<br />Order Reference ID: <b>" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "AP" + Convert.ToString(orderSummaryID) + "</b>"); Hashtable ht = (Hashtable)Session["htCustInfo"]; //sendMessage("You have an enquiry from " + (Convert.ToString(ht["Name"]) + " Please check your mail.")); Session["dtSelectProduct"] = null; Session["Cart"] = null; imgCheck.Visible = true; ltrDone.Text = "Enquiry Information has been sent successfully.<br /> Please note your Order Reference ID is <b>" + DateTime.Now.Year + "" + DateTime.Now.Month + "" + DateTime.Now.Day + "AP" + Convert.ToString(orderSummaryID) + "</b><br />"; btnConfirm.Visible = false; Label lblMaster = (Label)this.Master.FindControl("lblCartValue"); if (lblMaster != null) { if (Session["Cart"] == null) { lblMaster.Text = "(0)"; } else { DataTable dt = (DataTable)Session["Cart"]; lblMaster.Text = "(" + Convert.ToString(dt.Rows.Count) + ")"; } } } catch (Exception ex) { Response.Redirect("Error.aspx"); } }
protected void btnSend_Click(object sender, EventArgs e) { // for email try { string SMSResponse = ""; SMSCAPI obj = new SMSCAPI(); StudentRegistrationDAL s = new StudentRegistrationDAL(); string ToEmail = ""; for (int i = 0; i < gvStudentList.Rows.Count; i++) { GridViewRow row = gvStudentList.Rows[i]; Label lblEmail = (Label)row.FindControl("lblEmail"); HiddenField hdMobile = (HiddenField)row.FindControl("hdMobile"); LinkButton lnkId = (LinkButton)row.FindControl("lnkId"); CheckBox chkAll = (CheckBox)row.FindControl("chkAll"); bool EmailResponse = false; //string SMSResponse = ""; if (chkAll.Checked == true) { ToEmail = lblEmail.Text; if (chkEmail.Checked == true) { try { if (ToEmail != "") { EmailResponse = SendEmail1.SendBulkEmail(txtFromEmail.Text, ToEmail, txtSubject.Text, editor.Content, ""); //EmailResponse = SendEmail1.SendBulkEmail(txtFromEmail.Text, "", txtSubject.Text, editor.Content, ""); } } catch { } } if (chkSendSMS.Checked == true) { //for sms try { SMSResponse = obj.SendSMS("", "", "+" + hdMobile.Value, txtSmsContent.Text); } catch { } } try { string RegisterNo = s.InsertMailLog(lnkId.CommandArgument.ToString(), EmailResponse.ToString(), SMSResponse, txtSmsContent.Text, editor.Content); if (RegisterNo == "RegisterNo") { lblMessage.Text = "Send Sucessfully!"; lblMessage.ForeColor = System.Drawing.Color.Blue; } } catch { } } } try { SMSResponse = obj.SendSMS("", "", "+" + "+971505240146", txtSmsContent.Text); SMSResponse = obj.SendSMS("", "", "+" + "+971554783385", txtSmsContent.Text); } catch { } } catch (Exception ex) { lblMessage.Text = "Send Sucessfully!"; lblMessage.ForeColor = System.Drawing.Color.Blue; } }