public static void SendEmailNotification(string toEmail, string cc, string message, string body) { var email = new InsertSMSModel() { url = string.Empty, ToMail = toEmail, CC = cc, Status = "New", Type = "Email", Subject = message, Body = body, OrderNo = string.Empty }; try { using (var client = new EmailProcessOperationClient()) { var result = client.InsertEmail(email); if (!result.Success && result.Exception != null) { throw result.Exception; } } } catch (Exception ex) { Logger.Error("发送邮件接口异常", ex); } }
public static void InsertEmail(InsertSMSModel request) { try { using (var emailClient = new EmailProcessOperationClient()) { var insertResult = emailClient.InsertEmail(request); insertResult.ThrowIfException(true); _logger.Info($"邮件发送状态:{insertResult.Success}," + $"内容:{JsonConvert.SerializeObject(request)}"); } } catch (Exception ex) { _logger.Error($"发送邮件通知失败:{JsonConvert.SerializeObject(request)}", ex); } }
/// <summary> /// 往EmailProcess表中添加数据 /// </summary> /// <param name="emailProcess"></param> public void AddEmailProcess(BizEmailProcess emailProcess) { InsertSMSModel smsModel = new InsertSMSModel { OrderId = emailProcess.OrderID, OrderNo = emailProcess.OrderNo, Type = emailProcess.Type, Subject = emailProcess.Subject, //主题 ToMail = emailProcess.ToMail, //发给谁 FromMail = (string.IsNullOrEmpty(emailProcess.FromMail) ? "*****@*****.**" : emailProcess.FromMail), //谁发出 Body = emailProcess.Body, //内容 Status = emailProcess.Status, //状态 url = emailProcess.url, CC = emailProcess.CC //短信标识 }; using (var client = new EmailProcessOperationClient()) { var result = client.InsertEmail(smsModel); } }