public void SendEmail(RequistionDTO requistion, string userId) { DateTime createdOn = DateTime.Now; StringBuilder sb = new StringBuilder(); string strNewPath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["RequistionEmail"]); using (StreamReader sr = new StreamReader(strNewPath)) { while (!sr.EndOfStream) { sb.Append(sr.ReadLine()); } } string body = sb.ToString().Replace("#REQUISTIONNUMBER#", requistion.RequistionNumber); body = body.Replace("#DESCRIPTION#", requistion.Description); body = body.Replace("#CREATEDBY#", userId); body = body.Replace("#CREATEDON#", Convert.ToString(createdOn)); Helpers.Email email = new Helpers.Email(); email.MailBodyHtml = body; email.MailToAddress = ConfigurationManager.AppSettings["administrator-email"]; email.MailFromAddress = ConfigurationManager.AppSettings["EmailAddressFrom"]; email.Subject = ConfigurationManager.AppSettings["requistion_email_subject"]; email.SendMail(); logger.Debug("Email sent"); }
public void SendWelcomeEmail(string emailAddress, string firstName) { StringBuilder sb = new StringBuilder(); string strNewPath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["welcomeEmail"]); using (StreamReader sr = new StreamReader(strNewPath)) { while (!sr.EndOfStream) { sb.Append(sr.ReadLine()); } } string body = sb.ToString().Replace("#FIRSTNAME#", firstName); body = body.Replace("#YOUREMAIL#", emailAddress); Helpers.Email email = new Helpers.Email(); email.MailBodyHtml = body; email.MailToAddress = emailAddress; email.MailFromAddress = ConfigurationManager.AppSettings["no-reply-email"]; email.Subject = ConfigurationManager.AppSettings["welcome_email_subject"]; email.SendMail(); logger.Debug("Email sent"); }
public void SendProductSellerEmailNotificationWhenBiddingEnds(string body, string emailAddress) { Helpers.Email email = new Helpers.Email(); email.MailBodyHtml = body; email.MailToAddress = emailAddress; email.MailFromAddress = ConfigurationManager.AppSettings["EmailAddressFrom"]; email.Subject = "BIDDING FOR YOUR PRODUCT HAS ENDED"; try { email.SendMail(); } catch (Exception ex) { } }
//Send off query as email public void SendEmail(WebQueryDTO query) { StringBuilder sb = new StringBuilder(); string strNewPath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["QueryAsEmail"]); using (StreamReader sr = new StreamReader(strNewPath)) { while (!sr.EndOfStream) { sb.Append(sr.ReadLine()); } } string body = sb.ToString().Replace("#NAME#", query.Name); body = body.Replace("#PHONE#", query.PhoneNumber); body = body.Replace("#QUERY#", query.Body); body = body.Replace("#EMAIL#", query.EmailAddress); Helpers.Email email = new Helpers.Email(); email.MailBodyHtml = body; email.MailToAddress = ConfigurationManager.AppSettings["EmailAddressTo"]; email.MailFromAddress = ConfigurationManager.AppSettings["no-reply-email"]; email.Subject = ConfigurationManager.AppSettings["query_email_subject"]; try { email.SendMail(); logger.Debug("Email sent"); } catch (Exception ex) { logger.Debug("email Not Sent: " + ex.Message); } }
public void SendForgotPasswordEmail(string emailAddress, string firstName, string callBackUrl) { StringBuilder sb = new StringBuilder(); string strNewPath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["forgotPasswordEmail"]); using (StreamReader sr = new StreamReader(strNewPath)) { while (!sr.EndOfStream) { sb.Append(sr.ReadLine()); } } string body = sb.ToString().Replace("#FIRSTNAME#", firstName); body = body.Replace("#CALLBACKURL#", callBackUrl); Helpers.Email email = new Helpers.Email(); email.MailBodyHtml = body; email.MailToAddress = emailAddress; email.MailFromAddress = ConfigurationManager.AppSettings["EmailAddressFrom"]; email.Subject = ConfigurationManager.AppSettings["forgotPassword_email_subject"]; try { email.SendMail(); logger.Debug("Email sent"); } catch (Exception ex) { //Response.Write(ex.Message.ToString()); logger.Debug("Email has not been sent"); } }
//Send off comment as email public void SendCommentEmailToAdmin(CommentDTO query, string userName) { StringBuilder sb = new StringBuilder(); string strNewPath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["CommentAsEmail"]); using (StreamReader sr = new StreamReader(strNewPath)) { while (!sr.EndOfStream) { sb.Append(sr.ReadLine()); } } string body = sb.ToString().Replace("#MEDIAID#", Convert.ToString(query.MediaId)); body = body.Replace("#BODY#", query.Body); body = body.Replace("#USER#", userName); Helpers.Email email = new Helpers.Email(); email.MailBodyHtml = body; email.MailToAddress = ConfigurationManager.AppSettings["EmailAddressTo"]; email.MailFromAddress = ConfigurationManager.AppSettings["no-reply-email"]; email.Subject = ConfigurationManager.AppSettings["comment_email_subject"]; try { email.SendMail(); logger.Debug("Email sent"); } catch (Exception ex) { logger.Debug("email Not Sent: " + ex.Message); } }