/// <summary> /// Send mail to Provider matches email address with saved email address /// </summary> /// <param name="smtpClient">SMTL object</param> /// <param name="password">Descrypted password of provider</param> /// <returns>confirm sending</returns> private bool SendEmail(SmtpClient smtpClient, string password) { try { MailMessage message = new MailMessage(); string ToEmailAddress = txtEmail.Text.Trim(); if (!string.IsNullOrEmpty(ToEmailAddress.Trim())) { message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); message.To.Add(new MailAddress(ToEmailAddress)); message.Subject = LACESConstant.FORGETPASSWORD_SUBJECT; message.IsBodyHtml = true; message.Body = GetSendMessage(ToEmailAddress, password);//Send Email to Friend Message Body if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { smtpClient.Send(message);//Sending A Mail to the Sender Friend } return(true); } else { return(false); } } catch (Exception ex) { throw ex; } }
protected void SendDeleteForeverEmail(string strSendEmailTo, string subject, string title) { StringBuilder strbDeletedBody = new StringBuilder(); strbDeletedBody.Append("Dear LA CES Provider, <br /><br />"); strbDeletedBody.Append("Thank you for submitting " + title + " to LA CES. Unfortunately, we are unable to approve this course at this time as it does not meet LA CES <a href=\"http://laces.asla.org/ApprovedProviderGuidelines.aspx\">guidelines</a>. We encourage you to resubmit the course after revising it to meet LA CES guidelines. Please contact us at <a href=\"mailto:[email protected]\">[email protected]</a> with any questions or for more information. <br /><br />"); strbDeletedBody.Append("Sincerely,<br /><br />"); strbDeletedBody.Append("LA CES Administrator"); SmtpClient smtpClient = new SmtpClient(); //Get the SMTP server Address from SMTP Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP port 25; smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); //create the message body MailMessage message = new MailMessage(); message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); message.To.Add(new MailAddress(strSendEmailTo)); message.CC.Add(new MailAddress(LACESUtilities.GetApplicationConstants(LACESConstant.ADMIN_CONTACT_TO_EMAIL))); message.Subject = subject; message.IsBodyHtml = true; message.Body = strbDeletedBody.ToString(); if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { try { smtpClient.Send(message); } catch (Exception ex) { Response.Write(ex.Message); } } }
protected void SendEmail(string Text, string ProviderEmail) { try { SmtpClient smtpClient = new SmtpClient(); //Get the SMTP server Address from SMTP Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP post 25; smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); MailMessage message = new MailMessage(); message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); //message.To.Add(LACESUtilities.GetAdminToEmail()); //message.CC.Add(LACESUtilities.GetAdminCCEmail()); //Get the email's TO from Web.conf message.To.Add(ProviderEmail); string BCC = LACESUtilities.GetApplicationConstants(LACESConstant.ADMIN_CONTACT_TO_EMAIL); message.CC.Add(LACESUtilities.GetApprovedProviderMailTo()); message.Subject = "New Courses Added - Pending Approval"; message.IsBodyHtml = true; message.Body = Text; // Message Body if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { smtpClient.Send(message); //Sending A Mail to Admin } } catch (Exception ex) { Response.Write(ex.Message); Response.End(); } }
/// <summary> /// Return string array by spliting the string by a delimiter /// </summary> /// <param name="stringList">string</param> /// <returns>Array of String</returns> /// protected void SendMoreDataNeededEmail(Course c) { string strMessageBody = uiTxtEmailText.Text.Replace("\r\n", "<br />"); ApprovedProviderDataAccess apda = new ApprovedProviderDataAccess(); ApprovedProvider ap = apda.GetApprovedProviderByID(c.ProviderID); string strSendEmaiTo = ap.ApplicantEmail; SmtpClient smtpClient = new SmtpClient(); //Get the SMTP server Address from SMTP Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP port 25; smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); //create the message body MailMessage message = new MailMessage(); message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); message.To.Add(new MailAddress(strSendEmaiTo)); message.CC.Add(new MailAddress(LACESUtilities.GetApplicationConstants(LACESConstant.ADMIN_CONTACT_TO_EMAIL))); message.Subject = "LA CES Course Needs More Information"; message.IsBodyHtml = true; message.Body = strMessageBody; if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { try { smtpClient.Send(message); } catch (Exception ex) { Response.Write(ex.Message); } } }
protected void btnApprove_Click(object sender, EventArgs e) { CourseDataAccess objCourseDAL = new CourseDataAccess(); ///Loop all items in data list to check approve checkbox for approve one course foreach (RepeaterItem dl in dlCourseList.Items) { CheckBox chkApp = (CheckBox)dl.FindControl("chkApprove"); ///Get Course Id from hidden field HiddenField hidCourseID = (HiddenField)dl.FindControl("hidCourseID"); if (chkApp.Checked == true) { long courseId = Convert.ToInt64(hidCourseID.Value); if (courseId > 0) { bool approved = objCourseDAL.ApproveCourseByCourseId(courseId); if (approved) { Course approvedCourse = objCourseDAL.GetCoursesDetailsByID(courseId); string strTitle = approvedCourse.Title; string strHyperlink = approvedCourse.Hyperlink; string strStartDate = approvedCourse.StartDate.ToShortDateString(); string strEndDate = approvedCourse.EndDate.ToShortDateString(); string strDesc = approvedCourse.Description; string strCity = approvedCourse.City; string strState = approvedCourse.StateProvince; string strDistanceEd = approvedCourse.DistanceEducation; string strSubjects = approvedCourse.Subjects; string strHours = approvedCourse.Hours; string strLearningOutcomes = approvedCourse.LearningOutcomes; ApprovedProviderDataAccess apda = new ApprovedProviderDataAccess(); ApprovedProvider ap = apda.GetApprovedProviderByID(approvedCourse.ProviderID); string strSendEmaiTo = ap.ApplicantEmail; StringBuilder strbApprovedEmail = new StringBuilder(); string strEmailTitle = "An LA CES Course has been approved"; string strBodyIntro = "Congratulations, a course has been approved by LA CES administrators. Please review the information below carefully as it may have been revised during the approval process. <br />"; string strBodyEnd = "Please contact <a href=\"mailto:[email protected]\"> LA CES administrators </a> with any questions about the course."; strbApprovedEmail.Append(strBodyIntro + "<br />"); strbApprovedEmail.Append("Course Title: " + strTitle + "<br />"); strbApprovedEmail.Append("Course Hyperlink: " + strHyperlink + "<br />"); strbApprovedEmail.Append("Start Date: " + strStartDate + "<br />"); strbApprovedEmail.Append("End Date: " + strEndDate + "<br />"); strbApprovedEmail.Append("Description: " + strDesc + "<br />"); strbApprovedEmail.Append("City: " + strCity + "<br />"); strbApprovedEmail.Append("State: " + strState + "<br />"); strbApprovedEmail.Append("Distance Education: " + strDistanceEd + "<br />"); strbApprovedEmail.Append("Subject: " + strSubjects + "<br />"); strbApprovedEmail.Append("Hours: " + strHours + "<br />"); strbApprovedEmail.Append("Learning Outcomes: " + strLearningOutcomes + "<br /><br />"); strbApprovedEmail.Append(strBodyEnd + "<br />"); SmtpClient smtpClient = new SmtpClient(); //Get the SMTP server Address from SMTP Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP port 25; smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); //create the message body MailMessage message = new MailMessage(); message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); message.To.Add(new MailAddress(strSendEmaiTo)); message.Subject = strEmailTitle; message.IsBodyHtml = true; message.Body = strbApprovedEmail.ToString(); if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { try { // smtpClient.Send(message); } catch (Exception ex) { Response.Write(ex.Message); } } } } } } ///Re-load pending courses pendingCourses = objCourseDAL.GetAllPendingCourses(); dlCourseList.DataSource = pendingCourses; dlCourseList.DataBind(); ///Show success message lblMsg.Visible = true; lblMsg.ForeColor = System.Drawing.Color.Green; lblMsg.Text = "Selected course(s) approved successfully."; }
protected void SendApprovedEmail(long courseId) { CourseDataAccess objCourseDAL = new CourseDataAccess(); Course approvedCourse = objCourseDAL.GetCoursesDetailsByID(courseId); string strTitle = approvedCourse.Title; string strHyperlink = approvedCourse.Hyperlink; string strStartDate = approvedCourse.StartDate.ToShortDateString(); string strEndDate = approvedCourse.EndDate.ToShortDateString(); string strDesc = approvedCourse.Description; string strCity = approvedCourse.City; string strState = approvedCourse.StateProvince; string strDistanceEd = approvedCourse.DistanceEducation; string strSubjects = approvedCourse.Subjects; string strHours = approvedCourse.Hours; string strLearningOutcomes = approvedCourse.LearningOutcomes; ApprovedProviderDataAccess apda = new ApprovedProviderDataAccess(); ApprovedProvider ap = apda.GetApprovedProviderByID(approvedCourse.ProviderID); string strSendEmaiTo = ap.ApplicantEmail; StringBuilder strbApprovedEmail = new StringBuilder(); string strEmailTitle = "An LA CES Course has been approved"; string strBodyIntro = "Congratulations, a course has been approved by LA CES administrators. Please review the information below carefully as it may have been revised during the approval process. <br />"; string strBodyEnd = "Please contact <a href=\"mailto:[email protected]\"> LA CES administrators </a> with any questions about the course."; strbApprovedEmail.Append(strBodyIntro + "<br />"); strbApprovedEmail.Append("Course Title: " + strTitle + "<br />"); strbApprovedEmail.Append("Course Hyperlink: " + strHyperlink + "<br />"); strbApprovedEmail.Append("Start Date: " + strStartDate + "<br />"); strbApprovedEmail.Append("End Date: " + strEndDate + "<br />"); strbApprovedEmail.Append("Description: " + strDesc + "<br />"); strbApprovedEmail.Append("City: " + strCity + "<br />"); strbApprovedEmail.Append("State: " + strState + "<br />"); strbApprovedEmail.Append("Distance Education: " + strDistanceEd + "<br />"); strbApprovedEmail.Append("Subject: " + strSubjects + "<br />"); strbApprovedEmail.Append("Hours: " + strHours + "<br />"); strbApprovedEmail.Append("Learning Outcomes: " + strLearningOutcomes + "<br /><br />"); strbApprovedEmail.Append(strBodyEnd + "<br />"); SmtpClient smtpClient = new SmtpClient(); //Get the SMTP server Address from SMTP Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP port 25; smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); //create the message body MailMessage message = new MailMessage(); message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); message.To.Add(new MailAddress(strSendEmaiTo)); message.Subject = strEmailTitle; message.IsBodyHtml = true; message.Body = strbApprovedEmail.ToString(); if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { try { smtpClient.Send(message); } catch (Exception ex) { Response.Write(ex.Message); } } }
/// <summary> /// Sending a mail after adding a course to the system /// </summary> /// <param name="course">Details of the course for sending email</param> /// <param name="stateProvince">State name</param> private void sendMail(Course course, string stateProvince) { //Provider provider = (Provider)Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER]; // get provider information from Session ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // get approved provider information from Session string RefrenceURL = String.Empty; RefrenceURL = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.ToLower().LastIndexOf(LACESConstant.URLS.PROVIDER_BASE.ToLower())) + LACESConstant.URLS.ADMIN_BASE + "/" + LACESConstant.URLS.PENDING_COURSE; string courseDistance = string.Empty; if(course.DistanceEducation.Equals("Y")) { courseDistance = "Yes"; } else { courseDistance = "No"; } if(course.StateProvince.Trim().Equals(string.Empty)) { stateProvince = string.Empty; } StringBuilder EmailBody = new StringBuilder(); EmailBody.Append("<table border='0' width='100%>"); EmailBody.Append("<tr><td width='130'> </td><td> </td></tr>"); EmailBody.Append("<tr><td colspan='2'>A new course has been added to the system by " + Server.HtmlEncode(provider.OrganizationName) + " and is <a href='" + RefrenceURL + "'>pending approval</a>. Please review the details of the course and either approve or reject the course.</td></tr>"); EmailBody.Append("<tr><td colspan='2'><br/>The details of the new course are as follows:<br/></td></tr>"); EmailBody.Append("<tr><td valign='top' width='130'>Course Title:</td><td>" + Server.HtmlEncode(course.Title) + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>Course Hyperlink:</td><td>" + Server.HtmlEncode(course.Hyperlink) + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>Start Date:</td><td>" + course.StartDate.ToString("MM/dd/yyyy") + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>End Date:</td><td>" + course.EndDate.ToString("MM/dd/yyyy") + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>Description:</td><td>" + Server.HtmlEncode(course.Description) + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>City:</td><td>" + Server.HtmlEncode(course.City) + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>State:</td><td>" + Server.HtmlEncode(stateProvince) + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>Distance Education:</td><td>" + courseDistance + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>Subjects:</td><td>" + course.Subjects + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>Health:</td><td>" + course.Healths + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>Hours:</td><td>" + course.Hours + "</td></tr>"); EmailBody.Append("<tr><td valign='top'>Learning Outcomes:</td><td>" + Server.HtmlEncode(course.LearningOutcomes) + "</td></tr>"); EmailBody.Append("<tr><td colspan='2'><br/>If you wish to add this course to the " + LACESConstant.LACES_TEXT + " system, please <a href='" + RefrenceURL + "'>manage the list of pending courses</a> in the administration system to approve it.<br/></td></tr>"); EmailBody.Append("<tr><td colspan='2'><br/>If you are going to reject the course, or wish to discuss the course further, please contact the course provider <a href='mailto:" + provider.ApplicantEmail + "'>via email</a>.<br/></td></tr>"); EmailBody.Append("</table>"); string mailBody = EmailBody.ToString(); try { SmtpClient smtpClient = new SmtpClient(); //Get the SMTP server Address from SMTP Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP post 25; smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); MailMessage message = new MailMessage(); message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); //message.To.Add(LACESUtilities.GetAdminToEmail()); //message.CC.Add(LACESUtilities.GetAdminCCEmail()); //Get the email's TO from Web.conf message.To.Add(LACESUtilities.GetCourseNotificationMailTo()); message.Subject = "New Course Added - Pending Approval"; message.IsBodyHtml = true; message.Body = mailBody; // Message Body if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { smtpClient.Send(message); //Sending A Mail to Admin } } catch (Exception ex) { throw ex; } }
/// <summary> /// Used to send mail when admin add a new provider or update an existing provider. /// Return true is send mail successfull, otherwise return false. /// </summary> /// <param name="isUpdate">True if provider update mode</param> /// <returns>Return true if send mail successfull</returns> private bool SendMailToProvider(bool isUpdate) { try { SmtpClient smtpClient = new SmtpClient(); //Get the SMTP server Address from SMTP Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP port 25; smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); //create the message body MailMessage message = new MailMessage(); string adminToAddress = LACESUtilities.GetAdminToEmail().Replace(",", ";") + "?cc=" + LACESUtilities.GetAdminCCEmail(); string ToEmailAddress = Server.HtmlEncode(txtEmail.Text.Trim()); message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); message.To.Add(new MailAddress(txtEmail.Text.Trim())); message.Subject = "American Society of Landscape Architects:" + LACESConstant.LACES_TEXT + " Notification"; message.IsBodyHtml = true; string RefrenceURL = String.Empty; RefrenceURL = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/", Request.Url.AbsoluteUri.LastIndexOf("/") - 1)) + "/provider/" + LACESConstant.URLS.PROVIDER_LOGIN; //create the emailbody StringBuilder EmailBody = new StringBuilder(); EmailBody.Append("<html>"); EmailBody.Append("<head>"); EmailBody.Append("<title>Title</title>"); EmailBody.Append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"); EmailBody.Append("</head>"); EmailBody.Append("<body style=\"font-family: Arial, verdana, Helvetica, sans-serif; font-size:13px;\">"); string MailBody = ""; //if the provider is active if (radStatus.SelectedValue == "Y") { if (isUpdate) { MailBody = @"<div>Dear " + Server.HtmlEncode(txtOrganization.Text.Trim()) + ", </br></br> " + LACESConstant.LACES_TEXT + " admin updated your profile as an active provider. Your updated login information are as follows:</div></br>" + "<p><div>User Name: " + Server.HtmlEncode(txtEmail.Text.Trim()) + "</div>" + "<div>Password: "******"</div></p>" + "<p><div>You can access the " + LACESConstant.LACES_TEXT + " system at the following URL: " + "<a href=\"" + RefrenceURL + "\">" + RefrenceURL + "</a>.</p><p> If you require further assistance, please contact the " + LACESConstant.LACES_TEXT + " Administrators at the following email address: " + "<a href=\"mailto:" + adminToAddress + "\">" + LACESConstant.LACES_TEXT + " Administrators' Emails</a>.</p></div>"; } else { MailBody = @"<div>Dear " + Server.HtmlEncode(txtOrganization.Text.Trim()) + ", </br></br> " + LACESConstant.LACES_TEXT + " admin added you as an active provider. Your login information are as follows:</div></br>" + "<p><div>User Name: " + Server.HtmlEncode(txtEmail.Text.Trim()) + "</div>" + "<div>Password: "******"</div></p>" + "<p><div>You can access the " + LACESConstant.LACES_TEXT + " system at the following URL: " + "<a href=\"" + RefrenceURL + "\">" + RefrenceURL + "</a>.</p><p> If you require further assistance, please contact the " + LACESConstant.LACES_TEXT + " Administrators at the following email address: " + "<a href=\"mailto:" + adminToAddress + "\">" + LACESConstant.LACES_TEXT + " Administrators' Emails</a>.</p></div>"; } } //else if the provider is inactive else if (radStatus.SelectedValue == "N") { if (isUpdate) { MailBody = @"<div>Dear " + Server.HtmlEncode(txtOrganization.Text.Trim()) + ", </br></br> " + LACESConstant.LACES_TEXT + " admin updated your profile and set you as an inactive provider. Your login information are as follows:</div></br>" + "<p><div>User Name: " + Server.HtmlEncode(txtEmail.Text.Trim()) + "</div>" + "<div>Password: "******"</div></p>" + "<p><div>You can access the " + LACESConstant.LACES_TEXT + " system at the following URL when your account will be activated: " + "<a href=\"" + RefrenceURL + "\">" + RefrenceURL + "</a>.</p><p> If you require further assistance, please contact the " + LACESConstant.LACES_TEXT + " Administrators at the following email address: " + "<a href=\"mailto:" + adminToAddress + "\">" + LACESConstant.LACES_TEXT + " Administrators' Emails</a>.</p></div>"; } else { MailBody = @"<div>Dear " + Server.HtmlEncode(txtOrganization.Text.Trim()) + ", </br></br> " + LACESConstant.LACES_TEXT + " admin added you as an inactive provider. Your login information are as follows:</div></br>" + "<p><div>User Name: " + Server.HtmlEncode(txtEmail.Text.Trim()) + "</div>" + "<div>Password: "******"</div></p>" + "<p><div>You can access the " + LACESConstant.LACES_TEXT + " system at the following URL when your account will be activated: " + "<a href=\"" + RefrenceURL + "\">" + RefrenceURL + "</a>.</p><p> If you require further assistance, please contact the " + LACESConstant.LACES_TEXT + " Administrators at the following email address: " + "<a href=\"mailto:" + adminToAddress + "\">" + LACESConstant.LACES_TEXT + " Administrators' Emails</a>.</p></div>"; } } EmailBody.Append(MailBody); EmailBody.Append("</body>"); EmailBody.Append("</html>"); message.Body = EmailBody.ToString(); //finally send mail if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { smtpClient.Send(message); } return(true); } catch (Exception ex) { return(false); } }
/// <summary> /// Sends mail to admin and provier after submitting provider application /// </summary> /// <param name="receiverName"></param> /// <param name="receiverEmail"></param> public static void SendMailsAfterProviderApplicationRenewed(string receiverName, string receiverEmail, string receiverOrg) { SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try { //Get the SMTP server Address from Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP port from Web.conf smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); //SEND MAIL TO ADMIN //Get the email's FROM address from Web.conf message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); //Get the email's TO from Web.conf message.To.Add(LACESUtilities.GetApprovedProviderMailTo()); //message.CC.Add(new MailAddress("*****@*****.**", "*****@*****.**")); //Get the email's Subject message.Subject = "Provider has been renewed"; //Whether the message body would be displayed as html or not message.IsBodyHtml = true; //Get the email's BODY message.Body = "Dear Admin,<br /><br />" + HttpUtility.HtmlEncode(receiverName) + " (" + receiverEmail + ") from " + receiverOrg + " has renewed provider application.<br />Please review and send feedback.<br /><br />Thank you."; //Send the mail to admin if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { smtpClient.Send(message); } //SEND MAIL TO PROVIDER //Get the email's TO address message = new MailMessage(); //Get the email's FROM address from Web.conf message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); message.To.Add(new MailAddress(receiverEmail, receiverName)); message.CC.Add(new MailAddress("*****@*****.**", "*****@*****.**")); //message.CC.Add(new MailAddress("*****@*****.**", "*****@*****.**")); //Get the email's Subject message.Subject = "Your LA CES Transaction Has Been Processed"; //Whether the message body would be displayed as html or not message.IsBodyHtml = true; //Get the email's BODY message.Body = "Dear " + HttpUtility.HtmlEncode(receiverName) + ",<br /><br />Your LA CES transaction of $295.00 was charged to your credit card on " + System.DateTime.Today.ToShortDateString() + ". Please print this e-mail and keep as a receipt for your records.<br/><br/>Thank you,<br/><br/>LA CES<br/>[email protected]"; //Send the mail to provider if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { smtpClient.Send(message); } } catch (Exception exp) { } }
/// <summary> /// Perform request course code type action on user button click /// Generates mail message /// Send mail to administrator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnRequest_Click(object sender, EventArgs e) { try { //Get current provider //Provider provider = (Provider)Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER]; ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // get approved provider information from Session //Set to email address //Declare new mail SmtpClient smtpCl = new SmtpClient(); MailMessage omsg = new MailMessage(); //MailMessage omsg.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); omsg.To.Add(LACESUtilities.GetAdminToEmail()); omsg.CC.Add(LACESUtilities.GetAdminCCEmail()); //Set mail subject omsg.Subject = "New Course Code Requested"; //Set HTML mail format omsg.IsBodyHtml = true; string mailBody = Server.HtmlEncode(txtReason.Text.ToString().Trim()); //Replace new line with <BR> mailBody = mailBody.Replace("\r\n", "<BR>"); //Generate mail body omsg.Body = "Someone has requested a new Course Code be added to the " + LACESConstant.LACES_TEXT + " system. The details of the newly requested code are as follows:<br><br>"; omsg.Body += "Requested Code: " + Server.HtmlEncode(txtCodeType.Text.ToString()) + "<br>"; omsg.Body += "Reason: " + mailBody + "<br>"; omsg.Body += "Requester: " + provider.OrganizationName + "<br>"; omsg.Body += "Requester's Email: <a href='mailto:" + provider.ApplicantEmail + "'>" + provider.ApplicantEmail + "</a><br><br>"; omsg.Body += "If you wish to add this code to the " + LACESConstant.LACES_TEXT + " system, please <a href=\"http://" + Request.Url.Host.ToString() + "/admin/ManageCodeTypes.aspx\">manage the list of codes</a> in the administration system.<br><br>"; omsg.Body += "If you are going to reject the code, or wish to discuss the code further, please contact the course provider at their email address listed above."; //Set SMTP host from configuration smtpCl.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER).ToString(); smtpCl.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); //Send mail if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { smtpCl.Send(omsg); } //Generate thank you message message = ""; lblMessage.Visible = true; lblMessage.Text = "Thank You! Your code request has been successfully submitted."; btnRequest.Visible = false; //After altering user if courseid is defind then send user to course detials page else send user to course list page if (Request.QueryString["CourseID"] != null) { long courseID = Convert.ToInt64(Request.QueryString["CourseID"]); //message += "location.replace(\"CourseDetails.aspx?CourseID=" + courseID + "\");"; message = "<META http-equiv=\"refresh\" content=\"5;URL=CourseDetails.aspx?CourseID=" + courseID + "\">"; lblMessage.Text = lblMessage.Text + "<BR>(You will be automatically redirected to course details page in 5 seconds.)"; } else { message = "<META http-equiv=\"refresh\" content=\"5;URL=CourseList.aspx\">"; lblMessage.Text = lblMessage.Text + "<BR>(You will be automatically redirected to course listing page in 5 seconds.)"; } } catch (Exception ex) { throw ex; } }