public static void CreateReport(List <UserVisitInfo> u) { string body = "<html><body><H3>4小时内数据报表click.muyingzhijia.com</H3>"; for (int i = 1; i < 12; i++) { string head = " <H3>" + getIDName(i) + "</H3><table border = 1> <tr> <th> 会员号 </th> <th>手机号 </th><th> 浏览商品 </th> <th> 浏览时间</th></tr>"; foreach (UserVisitInfo a in u.Where(c => c.Type == i)) { head += ("<tr><td>" + a.Userid + "</td><td>" + a.Mobile + "</td><td>" + a.Url + "</td><td>" + a.LastVisitTime + "</td><td></tr>");//开始写入值 } head += "</table>"; body += head; } body += "</body></html>"; EmailServiceClient esc = new EmailServiceClient(); esc.Open(); esc.SendCmail(new WCFService.WcfMail() { Body = body, Subject = "4小时内数据报表click.muyingzhijia.com", MailTo = ("[email protected]; [email protected]; [email protected];[email protected];[email protected];[email protected];[email protected]; [email protected]".Split(new char[] { ',', ';' })), IsHtml = true }); esc.Close(); }
public static void CreateReport(List<UserVisitInfo> u) { string body = "<html><body><H3>4小时内数据报表click.muyingzhijia.com</H3>"; for (int i = 1; i < 12; i++) { string head = " <H3>" + getIDName(i) + "</H3><table border = 1> <tr> <th> 会员号 </th> <th>手机号 </th><th> 浏览商品 </th> <th> 浏览时间</th></tr>"; foreach (UserVisitInfo a in u.Where(c => c.Type == i)) { head += ("<tr><td>" + a.Userid + "</td><td>" + a.Mobile + "</td><td>" + a.Url + "</td><td>" + a.LastVisitTime + "</td><td></tr>");//开始写入值 } head += "</table>"; body += head; } body += "</body></html>"; EmailServiceClient esc = new EmailServiceClient(); esc.Open(); esc.SendCmail(new WCFService.WcfMail() { Body = body, Subject = "4小时内数据报表click.muyingzhijia.com", MailTo = ("[email protected]; [email protected]; [email protected];[email protected];[email protected];[email protected];[email protected]; [email protected]".Split(new char[] { ',', ';' })), IsHtml = true }); esc.Close(); }
public async Task <string> //SendByQuestionaryIdResponse> SendByQuestionaryIdAsync( SendByQuestionaryIdRequest questionaryIdRequest) { //fake get email list from application/domain/infrastructure //this list comes from everyone registered to the questionary //var questionaryEmails = _application.GetFormattedEmailsByQuestionaryId(questionaryIdRequest.QuestionaryId); var emailRequests = new List <EmailRequest> { new EmailRequest { EvaluationId = Guid.NewGuid(), Recipient = "*****@*****.**", Subject = "Asd asd asd", Content = "Asd asd asd", }, new EmailRequest { EvaluationId = Guid.NewGuid(), Recipient = "*****@*****.**", Subject = "Zxc zxc zxc", Content = "Zxc zxc zxc", } }; var emailServiceClient = new EmailServiceClient(); var emailResponses = await emailServiceClient.SendEmailAsync(emailRequests); emailServiceClient.Close(); //log emailResponses //return new SendByQuestionaryIdResponse(); var responseMessage = string.Join(",", emailResponses.Select(x => $"{x.Recipient}-{x.Status}")); return($"ManualEmailSender: {responseMessage}"); }
/// <summary> /// 重置登录密码 /// </summary> /// <param name="sType"></param> /// <param name="uid"></param> /// <returns></returns> public static MResult ResetLoginPassword(SystemType sType, string uid) { var result = new MResult(); try { var memberDal = DALFactory.Member(); var memberInfo = memberDal.GetMemberInfo(uid); if (memberInfo != null && memberInfo.membNo > 0) { var templatePath = HttpContext.Current.Server.MapPath("/Template/" + sType + "/ForgotPassword.xml"); var templateInit = false; if (File.Exists(templatePath)) { var xdom = XElement.Load(templatePath); var titleElement = xdom.Element("Title"); var bodyElement = xdom.Element("Body"); if (titleElement != null && bodyElement != null) { var emailTitle = titleElement.Value.Replace("\r", "").Replace("\n", "").Trim(); var emailBody = bodyElement.Value.Replace("\r", "").Replace("\n", "").Trim(); if (!string.IsNullOrEmpty(emailTitle) && !string.IsNullOrEmpty(emailBody)) { templateInit = true; string mailKey; int mailId; #region 写入 找回密码 记录到数据库 using (var bbHome = new BbHomeServiceClient()) { bbHome.Open(); string message; if (!bbHome.CheckPswKeyStatusByEmail(out mailId, out mailKey, out message, uid)) { bbHome.InsertPswKey(out mailId, out mailKey, out message, uid); } bbHome.Close(); } #endregion var mailBody = emailBody.Replace("{%MAILID%}", mailId.ToString()).Replace("{%MAIL%}", uid).Replace( "{%MAILKEY%}", HttpUtility.UrlEncode(mailKey)); var wcfmail = new WcfMail { MailTo = uid.Trim().Split(new[] { ',', ';' }), IsHtml = true, Subject = emailTitle, Body = mailBody }; using (var wcfClient = new EmailServiceClient()) { wcfClient.Open(); wcfClient.SendCmail(wcfmail); wcfClient.Close(); } result.status = MResultStatus.Success; } } } if (!templateInit) { result.status = MResultStatus.LogicError; result.msg = "模板不存在"; } } else { result.status = MResultStatus.LogicError; result.msg = "邮箱不存在!"; } } catch (Exception ex) { result.status = MResultStatus.ExecutionError; result.msg = "重置登录密码 出错!"; } return(result); }