public void SendMail(MailEntity entity) { ISendMail service = ServiceBroker.FindService <ISendMail>(); MailBodyV31 mail = new MailBodyV31(); mail.Body = new MailBodyMsg { CCMailAddress = entity.CC, CreateDate = DateTime.Now, MailBody = entity.Body, MailFrom = entity.From, MailTo = entity.To, Subjuect = entity.Subject }; mail.Header = Util.CreateServiceHeader(); DefaultDataContract contract = service.SendMail2MailDBInternal(mail); if (contract != null && contract.Faults != null && contract.Faults.Count > 0) { MessageFault fault = contract.Faults[0]; throw new Exception(string.Format("{0}\r\n{1}\r\n{2}", fault.ErrorCode, fault.ErrorDescription, fault.ErrorDetail)); } }