public void SendQuoteModifyMailSMTP(string dtpLastDateFollowup, string EmailIds, string bidTo, string ProjectName, string BidDate, string QuoteStatus, string LastFollowupby, string FollowupNote) { string rcptPrevailingTo = ""; string rcptPrevailingCC = ""; string sbody = ""; // rcptPrevailingCC = UserInfo.UserName; rcptPrevailingCC = Session["User"].ToString(); sbody = "<html><head></head>"; sbody = sbody + "<body><div style=" + "font-family: 'Calibri', 'sans-serif';font-size: 10px;" + "><span><span style='color:#1F497D'>"; sbody = sbody + "<b>The Following Quote Points are Modified by: " + Session["User"] + "</b>"; sbody = sbody + "<table><tr><td><b>Customer<b></td><td>: </td><td>" + bidTo + "</td></tr>"; sbody = sbody + "<tr><td><b>Project Description<b></td><td>: </td><td>" + ProjectName + "</td></tr>"; sbody = sbody + "<tr><td><b>Quote Date<b></td><td>: </td><td>" + BidDate + "</td></tr>"; sbody = sbody + "<tr><td><b>Quote Status<b></td><td>: </td><td>" + QuoteStatus + "</td></tr>"; if (dtpLastDateFollowup != "") { sbody = sbody + "<tr><td><b>Date of Last Followup<b></td><td>: </td><td>" + dtpLastDateFollowup + "</td></tr>"; } sbody = sbody + "<tr><td><b>Last Followup by<b></td><td>: </td><td>" + LastFollowupby + "</td></tr>"; sbody = sbody + "<tr><td><b>Followup Notes<b></td><td>: </td><td>" + FollowupNote + "</td></tr></table>"; sbody = sbody + "<b>This E-mail is automatically sent by SR Log Application.<b></span></span></div></body></html>"; rcptPrevailingTo = EmailIds; MailSend m = new MailSend(); m.sendMail(rcptPrevailingTo, "Quote Modified Status", sbody, rcptPrevailingCC, false); }
public void SendISBNAssignMail(ACS.Core.Domain.Product.ProductMaster mobj_ProductMaster) { try { ExecutiveMaster mobj_ExecutiveMaster = _ExecutiveService.GetExecutiveById(mobj_ProductMaster.EnteredBy); string mstr_body = string.Empty; using (StreamReader reader = new StreamReader(Path.Combine(System.Web.HttpContext.Current.Server.MapPath(@"~/MailHtml/ISBNAssignMail.html")))) { mstr_body = reader.ReadToEnd(); } mstr_body = mstr_body.Replace("{ExecutiveName}", mobj_ExecutiveMaster.executiveName); mstr_body = mstr_body.Replace("{ProductCode}", mobj_ProductMaster.ProductCode); mstr_body = mstr_body.Replace("{ISBN}", mobj_ProductMaster.OUPISBN); string mstrFromEmailID = _ISettingService.getValueByKey("FromEmailID"); string mstrBCCEmailID = _ISettingService.getValueByKey("BCCEmailId"); if (mstrFromEmailID != "" && mstrFromEmailID != null) { MailSend.SendMail(mstr_body, mobj_ExecutiveMaster.Emailid, mstrFromEmailID, mstrBCCEmailID); } } catch (Exception ex) { //_ILogger.Error(string.Format("Problem in Send Reply For Service", ex.Message), ex); } }
private void sendMail_Click(object sender, EventArgs e) { this.Hide(); MailSend frm = new MailSend(); frm.Show(); }
public void SendEmail(ContactUS cu) { string emailContent = ""; //var emailContent = string.Format(content, paymentInfo.InvoiceNumber, DateTime.Now.ToLongDateString(), DateTime.Now.ToLongTimeString() // , Request.Form["firstname"] // , Request.Form["email"] // , Request.Form["phone"] // , Request.Form["productinfo"] // , Request.Form["mihpayid"] // , Request.Form["txnid"] // , Request.Form["MachineMac"] // , paymentInfo.MachineIp // , paymentInfo.Browser // , Request.Form["status"] // , Request.Form["error"] + " " + Request.Form["error_Message"] // , paymentInfo.Amount, // paymentInfo.Currency); emailContent = "First Name: " + cu.FirstName; emailContent += "Last Name: " + cu.LastName; emailContent += "Email: " + cu.Email; emailContent += "Phone: " + cu.Phone; emailContent += "Company:" + cu.Company; emailContent += "ContactUs_Request:" + cu.ContactUs_Request; MailSend send = new MailSend(); send.Send("title of email", emailContent); }
private void GelBilgi() { try { string[] Gelen = g.GidenBilgi(SifremiUnuttumEpostaBox.Text); if (!string.IsNullOrEmpty(Gelen[0])) { string EpostsAdres = SifremiUnuttumEpostaBox.Text; string personel = Gelen[0].ToString(); personel = Ortak.Decrypt(personel); string Sifre = Gelen[1].ToString(); Sifre = Ortak.Decrypt(Sifre); string mesaj = "Sayın " + personel + "\n\r" + Ortak.E_Ticaret_SiteAdi + " kayıtlı üyelik bilgileriniz aşağıdaki gibidir.\n\rKullanıcı Adınız :" + EpostsAdres + "\n\rŞifreniz :" + Sifre + "\n\r\n\r" + "*Bu yalnızca gönderim amaçlı bir e-posta adresidir. Bu iletiyi yanıtladığınızda, yanıtınız izlenmez veya cevaplanmaz.\n\rSaygılarımızla...\r" + Ortak.E_Ticaret_SiteAdi + "\r" + Ortak.Eposta + "\r" + Ortak.SiteAdresi_http; MailSend.SifreYenileMail(EpostsAdres, "Şifre Hatırlatma | " + Ortak.E_Ticaret_SiteAdi, mesaj); SifreBox.Text = ""; Ortak.MesajGoster("Şifre E-Posta Adresine Gönderilmiştir."); SifremiUnuttumDiv.Visible = false; KullaniciAdiBox.Text = ""; SifreBox.Text = ""; SifremiUnuttumEpostaBox.Text = ""; } else { Ortak.MesajGoster("E-posta adresi bulanamadı ya da hatalı. Lütfen tekrar deneyiniz.");//!!! Dil } } catch (Exception) { Ortak.MesajGoster("Hata !!! Lütfen bilgileri kontrol edip tekrar deneyiniz.");//Dil !!! } finally { con.Close(); } }
public ActionResult Index3(string _from, string _subject, string _body) { MailSend mail = new MailSend(); mail.SendMail(_from, _subject, _body); return(Content("Error...Go Back")); }
public NewUserController(IBOUsers IBOUsers, IBOCountry IBOCountry, IHostingEnvironment HostEnvironment, IConfiguration configuration, IMemoryCache memoryCache) { _IBOUsers = IBOUsers; _IBOCountry = IBOCountry; _HostEnvironment = HostEnvironment; _config = configuration; _cache = memoryCache; _mail = new MailSend(_HostEnvironment, _config); }
public async Task <IActionResult> Contact(MailSend mail) { EmailService email = new EmailService(); var subject = "Hello from" + " " + mail.FirstName + " " + mail.LastName; await email.SendEmailAsync(mail.Email, subject, mail.DateOfBird.ToString()); mail = new MailSend(); return(View()); }
public string SendMailForgetPassword(ExecutiveMaster executive) { try { string mstr_body = string.Empty; string EmailTO = string.Empty; EmailTO = executive.Emailid; { StringBuilder mstr_searchparameter = new StringBuilder(); using (StreamReader reader = new StreamReader(Path.Combine(System.Web.HttpContext.Current.Server.MapPath(@"~/MailHtml/ForgetPassword.html")))) { mstr_body = reader.ReadToEnd(); } // mstr_body = mstr_body.Replace("#List", mstr_searchparameter.ToString()); DateTime now = DateTime.Now; mstr_body = mstr_body.Replace("#Date", now.ToString("D")); mstr_body = mstr_body.Replace("#MailDescription", "Your Password is : " + _encryptionService.DecryptText(executive.Password, "5152549987117761")); mstr_body = mstr_body.Replace("#RequstPersonName", executive.FullName()); mstr_body = mstr_body.Replace("#UpdateDate", now.toDDMMYYYY()); //mstr_body = mstr_body.Replace("#websiteImageURl#", _IServiceApplicationEmailSetup.getMailDescriptionByKey("FileUploadURL")); string mstrEmailToID = EmailTO; string mstrFromEmailID = _IServiceApplicationEmailSetup.getFromEmailIdByKey("FromEmailId"); string mstrSubject = "Forgot Password"; if (mstrEmailToID != "" && mstrEmailToID != null) { return(MailSend.SendMail_str(mstr_body, mstrEmailToID, mstrFromEmailID, mstrSubject)); } else { return(""); } } } catch (Exception ex) { return(ex.Message); } }
public void SendResetPasswordEmail(string toEmail, string userName, string guid) { const string xsmtpapi = "{\"to\": [\"{EmailTo}\"], \"sub\" : { \"%UserName%\" : [\"{UserName}\"], \"%Guid%\" : [\"{Guid}\"]}}"; var mail = new MailEndityWithTemplate { TemplateInvokeName = "ResetPassword", ApiKey = ConfigurationManager.AppSettings["SendCloud-ApiKey"].ToString(), ApiUser = ConfigurationManager.AppSettings["SendCloud-ApiUser"].ToString(), XsmtpApi = xsmtpapi.Format(new { EmailTo = toEmail, UserName = userName, Guid = guid }) }; MailSend.Send(mail); }
public int AddObj(MailSend mail) { int kq = 0; try { string sql = "insert into MAIL_SEND(MailTypeId, Address, Password, Note) values(" + mail.MailTypeId + ", N'" + mail.Address + "', N'" + mail.Password + "', N'" + mail.Note + "' )"; kq = dbclass.TruyVan_XuLy(sql); } catch (Exception ex) { throw ex; } return(kq); }
public async Task <IHttpActionResult> SendMailToAll() { var user = _userServcice.Get(2); string modelXml = ""; XmlSerializator.XmlSerialize(user, ref modelXml); QRCoderGenerator.GenerateSave(user.Guid.ToString(), $"{user.ExternalClientId}${user.BirthDate}"); var xslt = Convert.ToString(Lips.Tool.Properties.Resources.ActivateNewUser); if (MailSend.SendMail(modelXml, xslt, ConfigurationManager.AppSettings["mail"], $"Activate User - {user.Name}")) { return(Ok()); } return(BadRequest()); }
public bool UpdateLozinka(int KorisnikId, UserPromjenaLozinkeVM model) { NastavnoOsoblje x = GetLogirani(KorisnikId); if (x.login.Password == model.StaraLozinka) { x.login.Password = model.NovaLozinka; _context.SaveChanges(); // zbog potrebe testiranja koristimo zadani mail //MailSend.Send(_SmtpOptions, x.Ime + " " + x.Prezime, x.PodaciStanovanje.Email, "Uspjesno ste promijenjenili vašu lozinku."); MailSend.Send(_SmtpOptions, x.Ime + " " + x.Prezime, "*****@*****.**", "Uspješno ste promijenjenili vašu lozinku."); return(true); } return(false); }
static void Main(string[] args) { ReportDocument cryRpt; try { //MAil string expirecheck = DateTime.Now.AddDays(30).ToShortDateString(); string AccExpire = DateTime.Parse(expirecheck).ToString("yyyy-MM-dd"); ltclk_eteacherEntities db = new ltclk_eteacherEntities(); List <MoodlePaymentInfo> paymentRecords = db.MoodlePaymentInfoes.Include("MoodleSubjectInfo").Where(m => m.ExpireDate.ToString().StartsWith(AccExpire) && m.Active == 1).ToList(); Console.WriteLine("Connected to LTC Payment Gateway..."); DataTable dtReport = new DataTable(); //set payment records to datatable dtReport = new DataTableOut().ConvertPaymentInfo(paymentRecords.ToList()); ReportDocument myDataReport = new ReportDocument(); myDataReport.Load(@"E:\WEB\LTCTEMPLATE NEW\CONSOLE APP\LTCReportGen\LTCReportGen\Reports\DueDates.rpt"); myDataReport.SetDataSource(dtReport); string datetimenow = DateTime.Now.ToString(); datetimenow = DateTime.Parse(datetimenow).ToString("dd mm yyyy HH mm ss"); var filename = "LTC Moodle Account" + datetimenow + ".pdf"; var fullFilePathAndName = System.IO.Path.Combine("C:/PDFExport/", filename); myDataReport.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, fullFilePathAndName); Console.WriteLine("Report Exported : " + filename + ""); int sendMail = new MailSend().SendMail(fullFilePathAndName); if (sendMail > 0) { Console.WriteLine("Mail Send Success"); } else { Console.WriteLine("Mail Send Error"); } Console.ReadKey(); } catch (Exception ex) { Console.WriteLine("LTC ONLINE PAYMENT SYSTEM ERROR"); } }
public async Task <ActionResult> SendNewPassword(int id) { var user = await clienteAcessoRepo.GetByIdAsync(id); if (user.Id > 0) { var html = string.Format("Olá {0}!<br/> <p>Para acessar o sistema de avaliações PushStars, <a href='http://pushstars.effectlab.com.br'>clique aqui!</a> e digite a senha 123456.</p> <br/> Obrigado!!!", user.Nome); await MailSend.SendGridAsync(user.Email.Trim(), user.Nome, "Lembrete de senha", html); return(Json(new { erro = false })); } else { return(Json(new { erro = true })); } }
public void SendMail() { IAppConfig mailConfig = new MailAppConfig("apppid", "appkey", SignType.sha1); MailSend submail = new MailSend(mailConfig); submail.AddTo("*****@*****.**", "joe"); submail.AddCc("*****@*****.**", "leo"); submail.AddBcc("*****@*****.**", "leo"); submail.SetSender("*****@*****.**", "leo"); submail.SetReply("*****@*****.**"); submail.SetSubject("发送历史与明细"); submail.SetText("发送历史与明细"); //submail.AddAttachment(@"C:\attachment.txt"); string resultMessage = string.Empty; submail.Send(out resultMessage); Console.WriteLine(resultMessage); }
public void SendEmail(PaymentInfo paymentInfo, NameValueCollection Params) { //todo: put in resource file string content = @"Dear TechHighbrows team, It is to bring to your notice that a payment transaction has been made. Details recorded are as below, Invoice No : {0} Date : {1} Time : {2} Name : {3} Email : {4} Phone : {5} Product Description : {6} Amount : {15} {16} Invoice Number ID : {7} Transaction ID : {8} Machine Mac Address : {9} Machine IP : {10} Browser : {11} Status : {12} Status Message : {13} Error Code : {14} Email Sent From THB Online Payments"; var emailContent = string.Format(content, paymentInfo.InvoiceNumber, DateTime.Now.ToLongDateString(), DateTime.Now.ToLongTimeString() , paymentInfo.Name , paymentInfo.Email , paymentInfo.Phone , paymentInfo.ProductInfo , paymentInfo.InvoiceNumber , paymentInfo.TxnId , Request.Form["MachineMac"] , paymentInfo.MachineIp , paymentInfo.Browser , Params["order_status"] , Params["status_code"] , Params["status_message"] , paymentInfo.Amount, paymentInfo.Currency); MailSend send = new MailSend(); send.Send("Payment From : " + paymentInfo.Email + " Amount : " + paymentInfo.Amount + " Status : " + Params["order_status"], emailContent); }
public int UpdateObj(MailSend mail) { int kq = 0; try { string sql = "update MAIL_SEND set Address = N'" + mail.Address + "', Note=N'" + mail.Note + "', MailTypeId=" + mail.MailTypeId + ", IsActive='" + mail.IsActive + "' where Id =" + mail.Id + " and IsDeleted=0"; if (!string.IsNullOrEmpty(mail.Password)) { sql = "update MAIL_SEND set Address = N'" + mail.Address + "', Note=N'" + mail.Note + "', MailTypeId=" + mail.MailTypeId + ", Password=N'" + mail.Password + "', IsActive='" + mail.IsActive + "' where Id =" + mail.Id + " and IsDeleted=0"; } kq = dbclass.TruyVan_XuLy(sql); } catch (Exception ex) { throw ex; } return(kq); }
public void GeneralSend() { SmtpConfig mailConfig = new SmtpConfig(); SendStatus status = MailSend.MailTo(mailConfig, new MailAddress("*****@*****.**", "王勤军", Encoding.Default), new MailAddress("*****@*****.**", "王勤军", Encoding.Default), null, null, "邮件测试", "邮件内容", true, null); if (!status.Success) { //提示发送邮件错误 } }
public void InsertMailWS(MailSend ms) { RestClient client = new RestClient(this.WSUrl); var request = new RestRequest("Api/Mail/InsertMail", Method.POST); request.AddHeader("Authorization", this.AccessKey); request.AddJsonBody(ms); IRestResponse res = client.Execute(request); ServiceResponse <MailSend> sr = SimpleJson.DeserializeObject <ServiceResponse <MailSend> >(res.Content); if (sr.ResponseCode == 1) { throw new Exception(sr.ResponseMessage); } if (res.StatusCode != HttpStatusCode.OK) { throw new Exception(res.StatusDescription); } }
public void SendCustomerMailSMTP(int CustomerId, string CustomerName) { SR_Log_DatabaseSQLEntities db = new SR_Log_DatabaseSQLEntities(); SettingsRepository setting = new SettingsRepository(); string rcptCustInfoTo = ""; string sbody = ""; List <Customer_Info_Mail> lstcustmailto = setting.GetCustomerInfoMail(); foreach (var i in lstcustmailto) { rcptCustInfoTo += i.CustomerInfoMail + ";"; } sbody = "<html><head><meta http-equiv=Content-Type content='text/html; charset=us-ascii'><meta name=Generator content='Microsoft Word 12 (filtered medium)'></head>"; sbody = sbody + "<P style='color:#1F497D';><body lang=EN-US link=blue vlink=purple><div class=Section1><p class=MsoNormal><span style='font-size:12pt;font-family:'tahoma, verdana, 'sans-serif'''><span style='color:#1F497D'>"; sbody = sbody + "<b> The Following Customer is added in database by user : "******"User"]) + "</b><br><br>"; List <tblCustAddress> custAddressDetails = db.tblCustAddresses.Where(x => x.CustomerId == CustomerId).ToList(); sbody = sbody + "<table style='font-size:12pt;font-family:'tahoma, verdana, 'sans-serif'''>"; sbody = sbody + "<tr><td><b>CustomerName<b></td><td>: </td><td>" + CustomerName + "</td></tr>"; if (custAddressDetails != null) { if (custAddressDetails.Count > 0) { for (int i = 0; i < custAddressDetails.Count(); i++) { sbody = sbody + "<tr><td><b>Jobsite Address<b></td><td>: </td><td>" + custAddressDetails[i].Address1 + "</td></tr>"; } } } sbody = sbody + "</table>"; sbody = sbody + "<br />"; sbody = sbody + "<b>This E-mail is automatically sent by SR Log Database.<b></body></html>"; MailSend m = new MailSend(); m.sendMail(rcptCustInfoTo, "SR Log - New Customer Created", sbody, "", true); }
public void Migrate() { var oldMailSends = SourceDbContext.MailSends.ToList(); foreach (var oldMailSend in oldMailSends) { var newEntity = new MailSend() { Id = _mailSendKeyMapper.MapKey(oldMailSend.Id), SendOn = oldMailSend.SendOn, FromAddress = oldMailSend.FromAddress, ToAddress = oldMailSend.ToAddress, Subject = oldMailSend.Subject, }; TargetDbContext.MailSends.Add(newEntity); } TargetDbContext.SaveChanges(); }
private bool getNewQrClient(long userid) { var user = _userServcice.GetUserDetail(userid); string modelXml = ""; XmlSerializator.XmlSerialize(user, ref modelXml); QRCoderGenerator.GenerateSave(user.Guid.ToString(), $"{user.ExternalClientId}${user.BirthDate}"); string xslt = Convert.ToString(Lips.Tool.Properties.Resources.NewQRCodeLipsClient); if (MailSend.SendMail(modelXml, xslt, user.Email, $"Aanvraag QR code door {user.Name}, {user.Institution.Address}")) { xslt = Convert.ToString(Lips.Tool.Properties.Resources.NewQRCodeLips); if (MailSend.SendMail(modelXml, xslt, ConfigurationManager.AppSettings["mail"], $"Aanvraag QR code door {user.Name}, {user.Institution.Address}")) { return(true); } } return(false); }
public void SendMail() { IAppConfig mailConfig = new MailAppConfig("10050", "2be0927e1628e16e1ccdb6f5800caac9", SignType.sha1); MailSend submail = new MailSend(mailConfig); submail.AddTo("*****@*****.**", "joe"); submail.AddCc("*****@*****.**", "leo"); submail.AddBcc("*****@*****.**", "leo"); submail.SetSender("*****@*****.**", "leo"); submail.SetReply("*****@*****.**"); submail.SetSubject("发送历史与明细"); submail.SetText("发送历史与明细"); submail.AddAttachment(@"C:\attachment.txt"); string resultMessage = string.Empty; if (submail.Send(out resultMessage) == false) { Console.WriteLine(resultMessage); } }
public async Task <IHttpActionResult> UserRegister([FromBody] UserRegisterObject user) { if (ModelState.IsValid) { var controllerResult = new PaymentController((RegisterUserService)_registerUserService, (InstitutionService)_institutionService); var modelDto = new RegisterUserDto { BankId = user.BankID, City = user.City, Email = user.Email, Gender = (int)user.Gender, HouseNumber = user.HouseNumber, InstitutionHouseNumber = user.InstitutionHouseNumber, InstitutionId = user.InstitutionId, Name = user.Name, Phone = user.PhoneNumber, PostCode = user.Postcode, Street = user.Street, Guid = Guid.NewGuid().ToString(), ModifiedDate = DateTime.Now, PaymentStatus = PaymentStatusEnumDto.New, DateOfBirth = DateTime.ParseExact(user.DateOfBirth, "dd-MM-yyyy", null) }; var registeredUser = _registerUserService.Create(modelDto); string modelXml = ""; XmlSerializator.XmlSerialize(modelDto, ref modelXml); var tmp = await controllerResult.CreateMandate(user.BankID, registeredUser); var xslt = Convert.ToString(Lips.Tool.Properties.Resources.PaymentPendingClient); if (MailSend.SendMail(modelXml, xslt, user.Email, "In afwachting van uw betaling")) { return(Ok( controllerResult.CreateMandateResult )); } } return(BadRequest(ModelState)); }
public async Task <IHttpActionResult> ContactRequest(ContactRequestObject contact) { var user = _userServcice.GetUserDetail(this.userid); contact.Address = user.Address; contact.Institution = user.Institution.Address; contact.NameAuth = user.Name; contact.ClientId = user.ExternalClientId; string modelXml = ""; XmlSerializator.XmlSerialize(contact, ref modelXml); string xslt = Convert.ToString(Lips.Tool.Properties.Resources.ContactRequestLips); if (MailSend.SendMail(modelXml, xslt, ConfigurationManager.AppSettings["mail"], $"Contact aanvraag door {contact.Name} voor {contact.NameAuth}, {contact.Institution}")) { xslt = Convert.ToString(Lips.Tool.Properties.Resources.ContactRequestClient); if (MailSend.SendMail(modelXml, xslt, user.Email, $"Contact aanvraag door { contact.Name} voor { contact.NameAuth}, { contact.Institution}")) { return(Ok()); } } ; return(BadRequest()); }
public async Task <IHttpActionResult> UpdateStatus(long userID, string mandateId) { CustomDelegatingHandler customDelegatingHandler = new CustomDelegatingHandler(); HttpClient client = HttpClientFactory.Create(customDelegatingHandler); ServicesRoot body = new ServicesRoot(); body.Services = new ServicesObject(); body.Services.ServiceList = new List <ServiceList>() { new ServiceList() { Name = "emandate", Action = "GetStatus", Parameters = new List <ParameterObject>() { new ParameterObject() { Name = "mandateid", Value = mandateId } } } }; var user = _registerUser.Get(userID); if (user.IsMailSend) { return(BadRequest("Mail was send")); } HttpResponseMessage response = await client.PostAsJsonAsync(apiBaseAddress, body); var result = response.Content.ReadAsStringAsync().Result; if (user.MandateId == mandateId) { var resultObject = Newtonsoft.Json.JsonConvert.DeserializeObject <ServicesObject>(result); PaymentStatusEnumDto enumStatus; if (Enum.TryParse(resultObject.Services.FirstOrDefault().Parameters.Where(m => { return(m.Name == "EmandateStatus"); }).FirstOrDefault().Value, out enumStatus)) { string IBAN = resultObject.Services.FirstOrDefault().Parameters.Where(m => { return(m.Name == "Iban"); })?.FirstOrDefault()?.Value; user.IBAN = IBAN; user.Amount = resultObject.Services.FirstOrDefault().Parameters.Where(m => { return(m.Name == "MaxAmount"); })?.FirstOrDefault()?.Value; string modelXml = ""; XmlSerializator.XmlSerialize(user, ref modelXml); string xslt = Convert.ToString(Lips.Tool.Properties.Resources.PaymentNewClient); MailSend.SendMail(modelXml, xslt, user.Email, "WasApp " + user.Name + " - New user"); xslt = Convert.ToString(Lips.Tool.Properties.Resources.PaymentLastStatusClient); if (enumStatus == PaymentStatusEnumDto.Success) { MailSend.SendMail(modelXml, xslt, user.Email, "Ontvangstbevestiging van uw betaling"); xslt = Convert.ToString(Lips.Tool.Properties.Resources.PaymentNewClientLips); if (MailSend.SendMail(modelXml, xslt, ConfigurationManager.AppSettings["mail"], $"Automatische incasso {user.Name}, {user.InstitutionId}")) { user.IsMailSend = true; } } // else if (enumStatus == PaymentStatusEnumDto.Failure) // { // MailSend.SendMail(modelXml, xslt, user.Email, "WasApp " + user.Name + "- payment " + user.MandateId + " failured"); // } // else if (enumStatus == PaymentStatusEnumDto.Failure) // { // MailSend.SendMail(modelXml, xslt, user.Email, "WasApp " + user.Name + "- payment " + user.MandateId + " cancelled"); // } user.PaymentStatus = enumStatus; _registerUser.Update(user); return(Ok(resultObject.Services.FirstOrDefault().Parameters.Where(m => { return m.Name == "EmandateStatus"; }))); } else { return(BadRequest("Wrong Payment status")); } } else { return(BadRequest("Wrong MandateID")); } }
void sendParcelSentEmailNotification(Invoice invoice) { MailSend email = new MailSend(invoice, Enums.MessageType.PARCEL_SENT_NOTIFICATION); email.save(); }
public void SendMail(MailInput mail) { //validation if (mail.To == "") { throw new Exception("Please enter an E-Mail address to 'To' parameter!"); } try { if (mail.To.Contains(';') == false) { var addr = new System.Net.Mail.MailAddress(mail.To); } else { foreach (string item in mail.To.Split(';')) { if (item != "") { var addr = new System.Net.Mail.MailAddress(item); } } } if (mail.CC != null) { if (mail.CC.Contains(';') == false) { var addr = new System.Net.Mail.MailAddress(mail.CC); } else { foreach (string item in mail.CC.Split(';')) { if (item != "") { var addr = new System.Net.Mail.MailAddress(item); } } } } } catch (Exception) { throw new Exception("One of the receipent mail addresses are not valid."); } if (mail.ConnectionMethod == null) { throw new Exception("Please select a connection method."); } if (mail.MailType == null) { throw new Exception("Please select a mail type."); } //prepare object instance MailSend ms = new MailSend(); if (mail.MailTemplateId != null) { if (string.IsNullOrEmpty(this.ConnectionString)) { throw new Exception("Template stucture is only available with db connection."); } List <IDataParameter> paramlist = new List <IDataParameter>(); paramlist.Add(new CustomParameter("id", mail.MailTemplateId)); List <MailTemplate> mtlist = qm.GetQueryResult <MailTemplate>("GetMailTemplate", paramlist); if (mtlist.Count == 0) { throw new Exception("Mail Template has not been found on db!"); } else { MailTemplate mt = mtlist[0]; string[] variables = null; string body = File.ReadAllText(mt.TemplateText); if (mt.Variables != "" && mt.Variables.Contains(",")) { variables = mt.Variables.Split(','); } if (mt.QueryType == "select") { DataTable dt = qm.GetQueryResultDataTableDirect(mt.Query, null); if (dt.Rows.Count > 0) { string itr = ""; if (body.Contains("##for") && body.Contains("##endfor")) { Regex rgx = new Regex("##for(\n|.)*##endfor"); MatchCollection mtcol = rgx.Matches(body); foreach (Match mtc in mtcol) { if (mtc.Success) { itr = mtc.Value; string newstr = itr; string lastStr = ""; foreach (DataRow dr in dt.Rows) { foreach (string vr in variables) { newstr = newstr.Replace("#" + vr, dr[vr].ToString()); } lastStr = lastStr + newstr; newstr = itr; } body = body.Replace(itr, lastStr); } } } DataRow drow = dt.Rows[0]; foreach (string vr in variables) { body = body.Replace("#" + vr, drow[vr].ToString()); } body = body.Replace("##for", "").Replace("##endfor", ""); } } else if (mt.QueryType == "execute") { int result = qm.ExecuteQueryText(mt.Query); } else { throw new Exception("Please choose querytype between select and execute options."); } ms.Body = body; } } else { ms.Body = mail.Body; } ms.FilePath = mail.AttachPath; ms.MailType = Convert.ToInt16(mail.MailType); ms.MailStatus = 1; ms.Module = ""; ms.Sender = mail.From; ms.SendDate = mail.SendDate; ms.Subject = mail.Subject; ms.ToAddress = mail.To; ms.CC = mail.CC; ms.InsertDate = DateTime.Now; if (ms.SendDate == null) { ms.SendDate = DateTime.Now; } //insert to sendmail if (mail.ConnectionMethod == ConnectionMethod.DataBase) { if (ConnectionString == "") { throw new Exception("Altough your connection method is Database. Your connection string is empty!. Please enter valid database connection string into constructor method."); } mc.InsertMailDB(ms); } else if (mail.ConnectionMethod == ConnectionMethod.WebApi) { if (AccessKey == "") { throw new Exception("Altough your connection method is Web Api. Your AccessKey is empty!. Please enter valid Access Key into constructor method."); } mc.InsertMailWS(ms); } }
public static bool addMember(Member member, Guid tenantId) { bool isV = false; try { DateTime now = DateTime.Now; member.createTime = now; member.updateTime = now; member.memberCode = getMemberCode(); member.password = Utils.ConverToMD5(member.password); int memberId = DataManager.memberDao.addMember(member); Tenant tenant = DataManager.tenantDao.getTenant(tenantId); Member admin = DataManager.memberDao.getMember(tenant.createdMemberId); //判斷是否需要寄送mailNotice TenantSetting setting = DataManager.tenantDao.getTenantSetting(tenantId, "MemCheckType"); if (setting != null) { TenantSetting mailInfo = null; MailInfo mail = null; string type = null; List <MailSend> sendList = new List <MailSend>(); switch (setting.content) { case "Auto": mailInfo = DataManager.tenantDao.getTenantSetting(tenantId, "MemPassMailInfo"); mail = JsonConvert.DeserializeObject <MailInfo>(mailInfo.content); type = "會員自動審核"; break; case "Manual": mailInfo = DataManager.tenantDao.getTenantSetting(tenantId, "MemReviewMailInfo"); mail = JsonConvert.DeserializeObject <MailInfo>(mailInfo.content); type = "會員審核提醒"; break; } if (mail != null) { MailSend mailSend = new MailSend { memberId = memberId, tenantId = tenantId.ToString(), mail = member.email, tenantName = tenant.tenantName, CC = admin.email }; sendList.Add(mailSend); Debug.WriteLine("asdsada" + mail.content.Replace("\n", "</br>")); MailNotice mailNotice = new MailNotice { tenantId = tenantId, type = type, title = mail.subject, content = mail.content.Replace("\n", "</br>"), sendTo = JsonConvert.SerializeObject(sendList), isAuto = true, dtSend = DateTime.Now.AddMinutes(10), isSend = false, status = "正常", createTime = DateTime.Now, creator = memberId }; DataManager.mailNoticeDao.add(mailNotice); } } TenantMember tenantMember = new TenantMember(); tenantMember.tenantId = tenantId; tenantMember.memberId = memberId; tenantMember.isBlockade = false; tenantMember.status = "待審核"; tenantMember.creator = member.memberId; tenantMember.createTime = now; tenantMember.updateTime = now; DataManager.tenantMemberDao.addTenantMember(tenantMember); isV = true; } catch (Exception e) { Debug.WriteLine("[CMemberManager-addMember] error:" + e.StackTrace); } return(isV); }
public NastavnoOsoblje Add(NastavnikDodajVM model) { PodaciRodjenje podaciRodjenje = new PodaciRodjenje { DatumRodjenja = model.DatumRodjenja, OpćinaRođenja = model.OpcinaRodjenja, GradID = model.MjestoRodjenjaID, DrzavaID = model.DrzavaRodjenjaID }; _context.podaciRodjenje.Add(podaciRodjenje); PodaciStanovanje podaciStanovanje = new PodaciStanovanje { GradID = model.GradID, DrzavaID = model.DrzavaID, OpćinaPrebivalista = model.OpćinaPrebivalista, Adresa = model.Adresa, BrojTelefona = model.BrojTelefona, Email = model.Email }; _context.podaciStanovanje.Add(podaciStanovanje); OstaliPodaciNastavnoOsoblje ostaliPodaci = new OstaliPodaciNastavnoOsoblje { Drzavljanstvo = model.Drzavljanstvo, Nacionalnost = model.Nacionalnost }; _context.ostaliPodaciNastavnoOsoblje.Add(ostaliPodaci); PodaciZanimanje podaciZanimanje = new PodaciZanimanje { ZavrsenaSkola = model.ZavrsenaSkola, ZavrsenFakultet = model.Fakultet, ZavrsenoZanimanje = model.ZavrsenoZanimanje, BrojDiplome = model.BrojDiplome, StrucnaSpremaID = model.StrucnaSpremaID, DrzavniIspit = model.PosjedujeDrzavniIspit }; _context.podaciZanimanje.Add(podaciZanimanje); Login log = new Login { Password = Guid.NewGuid().ToString().Substring(0, 6) }; if (_context.login.Where(x => x.Username == model.Ime.ToLower() + "." + model.Prezime.ToLower()).SingleOrDefault() == null) { log.Username = model.Ime.ToLower() + "." + model.Prezime.ToLower(); } else { log.Username = model.Prezime.ToLower() + "." + model.Ime.ToLower(); } _context.login.Add(log); NastavnoOsoblje nastavnoOsoblje = new NastavnoOsoblje { Ime = model.Ime, ImeRoditelja = model.ImeRoditelja, Prezime = model.Prezime, Pol = model.Pol, JMBG = model.JMBG, PodaciRodjenje = podaciRodjenje, PodaciStanovanje = podaciStanovanje, OstaliPodaciNastavnoOsoblje = ostaliPodaci, podaciZanimanje = podaciZanimanje, login = log, PhotoPath = FileUploadDelete.Upload(_hostingEnvironment, model.Photo, "imageUpload") }; _context.nastavnoOsoblje.Add(nastavnoOsoblje); _context.SaveChanges(); MailSend.Send(_smtpConfig, nastavnoOsoblje.Ime + " " + nastavnoOsoblje.Prezime, "*****@*****.**", "Dodani ste kao korisnik aplikacije.\nVaši login podaci: \nUsername: "******"\nPassword: " + log.Password); return(nastavnoOsoblje); }