private void SendMail() { string company = txtCompanyName.Text; string email = txtEmail.Text; MailDefinition md = new MailDefinition(); md.BodyFileName = "~/MailTemplates/SeminarRegistration.htm"; Dictionary<string, string> d = new Dictionary<string, string>(); string jobAction = ""; switch (ddlFirmAction.SelectedValue) { case "1": jobAction = "Брендовая розница"; break; case "2": jobAction = "Медийное агентство"; break; case "3": jobAction = "Маркетинговое агентство"; break; case "4": jobAction = "Туристическое агентство"; break; case "5": jobAction = "Юридическая компания"; break; case "6": jobAction = "Другие профессиональные услуги"; break; } d.Add("<%Email%>", email); d.Add("<%JobAction%>", jobAction); d.Add("<%CompanyName%>", company); d.Add("<%Name%>", txtFio.Text); d.Add("<%JobTitle%>", txtJobTitle.Text); d.Add("<%Site%>", txtSite.Text); md.IsBodyHtml = true; ContactFormsCache forms = new ContactFormsCache(); string formName = "SeminarRegistration"; ContactForm form = forms.GetByName(formName); if (form == null) throw new InvalidOperationException(string.Format("Can not find settings for form {0}", formName)); string subject = form.Subject; string to = form.To; string cc = form.CC; md.Subject = string.Format(subject, company); if (!string.IsNullOrEmpty(cc)) { md.CC = cc; } MailMessage message = md.CreateMailMessage(to, d, this); SmtpClient sc = new SmtpClient(); sc.Send(message); }
private static void SendEmail(int id, int statusid, string email, string serial) { MailDefinition md = new MailDefinition(); md.BodyFileName = "~/MailTemplates/MacAction_ChangeStatus.htm"; Dictionary<string, string> d = new Dictionary<string, string>(); string status = string.Empty; switch (statusid) { case 0: status = "На стадии проверки"; break; case 1: status = "Дополнительная гарантия подтверждена"; break; case 2: status = "Заявка на дополнительную гарантию отклонена. Чтобы уточнить причину отказа, свяжитесь с оператором по телефону 0 800 302 777 0"; break; case 3: status = "Ошибка ввода данных. Пожалуйста, введите серийный номер еще раз или свяжитесь с оператором по телефону 0 800 302 777 0"; break; default: break; } d.Add("<%Serial%>", serial); d.Add("<%Status%>", status); md.IsBodyHtml = true; ContactFormsCache forms = new ContactFormsCache(); string formName = "MacAction"; ContactForm form = forms.GetByName(formName); if (form == null) throw new InvalidOperationException(string.Format("Can not find settings for form {0}", formName)); string subject = form.Subject; string to = email; md.Subject = subject; MailMessage message = md.CreateMailMessage(to, d, new Label()); SmtpClient sc = new SmtpClient(); sc.Send(message); }
private void SendMail() { string company = txtCompanyName.Text; string contact = txtContactName.Text; string address = txtAddress.Text; string phone = txtPhone.Text; string email = txtEmail.Text; bool isPartner = rbIsPartner.Checked; bool isServicePartner = rbIsServicePartner.Checked; string status = this.Status.ToString(); MailDefinition md = new MailDefinition(); md.BodyFileName = "~/MailTemplates/StatusRequest.htm"; Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("<%Status%>", status); d.Add("<%CompanyName%>", company); d.Add("<%ContactName%>", contact); d.Add("<%Address%>", address); d.Add("<%Phone%>", phone); d.Add("<%Email%>", email); d.Add("<%IsPartner%>", isPartner ? "yes" : "no"); d.Add("<%IsServicePartner%>", isServicePartner ? "yes" : "no"); md.IsBodyHtml = true; ContactFormsCache forms = new ContactFormsCache(); string formName = string.Format("Request_{0}",Status); ContactForm form = forms.GetByName(formName); if (form == null) throw new InvalidOperationException(string.Format("Can not find settings for form {0}", formName)); string subject = form.Subject; string to = form.To; string cc = form.CC; md.Subject = string.Format(subject, company); if (!string.IsNullOrEmpty(cc)) { md.CC = cc; } MailMessage message = md.CreateMailMessage(to, d, this); SmtpClient sc = new SmtpClient(); sc.Send(message); }
private void SendMail(iPadActionSerial item) { MailDefinition md = new MailDefinition(); md.BodyFileName = "~/MailTemplates/request_iPadAction.htm"; Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("<%Serial%>", item.Serial); d.Add("<%BuyDate%>", item.BuyDate.ToShortDateString()); d.Add("<%Email%>", item.Email); d.Add("<%Seller%>", item.SellerName); md.IsBodyHtml = true; ContactFormsCache forms = new ContactFormsCache(); string formName = string.Format("Request_{0}", Apple.Web.Controls.RequestStatusForm.StatusType.iPadAction); ContactForm form = forms.GetByName(formName); if (form == null) throw new InvalidOperationException(string.Format("Can not find settings for form {0}", formName)); string subject = form.Subject; string to = form.To; string cc = form.CC; md.Subject = subject; if (!string.IsNullOrEmpty(cc)) { md.CC = cc; } MailMessage message = md.CreateMailMessage(to, d, this); SmtpClient sc = new SmtpClient(); sc.Send(message); }
private void SendMail() { string lastName = txtLastName.Text; string firstName = txtFirstName.Text; string position = txtPosition.Text; string company = txtCompany.Text; string comment = txtComment.Text; string email = txtEmail.Text; string phone = txtTelephone.Text; MailDefinition md = new MailDefinition(); md.BodyFileName = "~/MailTemplates/Feedback.htm"; Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("<%LastName%>", lastName); d.Add("<%FirstName%>", firstName); d.Add("<%Position%>", position); d.Add("<%Company%>", company); d.Add("<%Comment%>", comment); d.Add("<%Email%>", email); d.Add("<%Phone%>", phone); md.IsBodyHtml = true; ContactFormsCache forms = new ContactFormsCache(); string formName = "Feedback"; ContactForm form = forms.GetByName(formName); if (form == null) throw new InvalidOperationException(string.Format("Can not find settings for form {0}",formName)); string subject = form.Subject; string to = form.To; string cc = form.CC; md.Subject = string.Format(subject, firstName, lastName); if (!string.IsNullOrEmpty(cc)) { md.CC = cc; } MailMessage message = md.CreateMailMessage(to, d, this); SmtpClient sc = new SmtpClient(); sc.Send(message); }