Пример #1
0
        /*internal static void SendPasswordResetEmail(string email, string passwordResetToken)
        {
            string resetLink = "<a href='" + WebSettings.WebsiteDomain +
                   "Account/ResetPassword?user="******"&ver=" + passwordResetToken + "'>Reset Password</a>";
            try
            {
                MailDefinition mail = new MailDefinition();
                mail.BodyFileName = WebSettings.PasswordResetEmailTemplate;
                mail.Subject = WebSettings.PasswordResetEmailSubject;
                mail.From = WebSettings.SmtpEmailUsername;
                mail.IsBodyHtml = true;

                Dictionary<string, string> replacemets = new Dictionary<string, string>();
                replacemets.Add("#RESETLINK#", ValueToString(resetLink));

                MailMessage message = mail.CreateMailMessage(email, replacemets, new System.Web.UI.Control());

                EmailHandler handler = new EmailHandler(message);
                Thread sendEmail = new Thread(new ThreadStart(handler.SendEmail));
                sendEmail.Start();
            }
            catch (Exception)
            {
                throw;
            }
        }*/
        internal static void SendEnquiryEmail(EnquiryModel model)
        {
            try
            {
                MailDefinition mail = new MailDefinition();

                mail.From = WebSettings.EmailUsername;
                mail.Subject = WebSettings.EnquiryEmailSubject;
                mail.BodyFileName = WebSettings.EnquiryEmailTemplate;
                mail.IsBodyHtml = true;

                //ListDictionary replacements = ResetLinkToDictionary(order);
                Dictionary<string, string> replacements = new Dictionary<string, string>();
                EmailSender sender = new EmailSender();

                replacements = sender.EnquiryToDictionary(model);

                MailMessage message = mail.CreateMailMessage(WebSettings.AdminEmail, replacements, new System.Web.UI.Control());

                EmailHandler handler = new EmailHandler(message);
                Thread thread = new Thread(new ThreadStart(handler.SendEmail));
                thread.Start();
                // LoggerService.Info(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], "Enquiry email sent to " + WebSettings.AdminEmail);

            }
            catch (Exception)
            {
                // LoggerService.Error(e.Message, "Stack Trace: " + e.StackTrace, "");
                throw;
            }
        }
Пример #2
0
        internal static void SendTourQuoteEmail(TourQuoteModel model)
        {
            MailDefinition mail = new MailDefinition();

            mail.From = WebSettings.EmailUsername;
            mail.Subject = WebSettings.TourQuoteEmailSubject;
            mail.BodyFileName = WebSettings.TourQuoteEmailTemplate;
            mail.IsBodyHtml = true;

            //ListDictionary replacements = ResetLinkToDictionary(order);
            Dictionary<string, string> replacements = new Dictionary<string, string>();
            EmailSender sender = new EmailSender();

            replacements = sender.TourQuoteToDictionary(model);

            MailMessage message = mail.CreateMailMessage(WebSettings.AdminEmail, replacements, new System.Web.UI.Control());

            EmailHandler handler = new EmailHandler(message);
            Thread thread = new Thread(new ThreadStart(handler.SendEmail));
            thread.Start();
        }