private void start() { StringBuilder sb = new StringBuilder(); DataSet ds = JobProductRequestDA.GetJobProductRequest(setEntity()); if (!(ds.Tables[0].Rows.Count > 0)) { return; } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { bindRow(sb, ds.Tables[0].Rows[i]); } string content = EmailResources.EmailContent.Replace("@CONTENT", sb.ToString()); MailEntity entity = new MailEntity() { From = ConfigurationManager.AppSettings["EmailFrom"].ToString(), To = ConfigurationManager.AppSettings["EmailTo"].ToString(), CC = ConfigurationManager.AppSettings["EmailCC"].ToString(), Body = content, Subject = EmailResources.EmailTitle }; EmailComparisonCNServiceFacade.SendProductEmail(entity); log("邮件发送成功"); }
public bool Put(NewTicketEntity entity) { ManageSQLConnection manageSQLConnection = new ManageSQLConnection(); List <KeyValuePair <string, string> > sqlParameters = new List <KeyValuePair <string, string> >(); sqlParameters.Add(new KeyValuePair <string, string>("@TicketID", (entity.ticket_id).ToString())); sqlParameters.Add(new KeyValuePair <string, string>("@assingedTo", (entity.assingedTo).ToString())); sqlParameters.Add(new KeyValuePair <string, string>("@Ticketstatus", entity.Ticketstatus)); sqlParameters.Add(new KeyValuePair <string, string>("@short_desc", entity.short_desc)); // sqlParameters.Add(new KeyValuePair<string, string>("@URL", entity.URL)); sqlParameters.Add(new KeyValuePair <string, string>("@StatusCode", (entity.StatusCode).ToString())); sqlParameters.Add(new KeyValuePair <string, string>("@CC", entity.CC)); var result = manageSQLConnection.UpdateValues("UpdateTickets", sqlParameters); MailSending mailSending = new MailSending(); //Mail sending MailEntity mailEntity = new MailEntity { FromMailid = GlobalVariables.FromMailid, FromPassword = GlobalVariables.Password, ToMailid = entity.assingedTo, ToCC = entity.bodyMessage.TOCC, Port = GlobalVariables.Port, Subject = entity.short_desc, BodyMessage = mailSending.BodyMessage(entity.bodyMessage, entity.ticket_id), SMTP = GlobalVariables.Host }; mailSending.Send(mailEntity); return(result); }
private void AddLabelsToMail(String gmLabels, MailEntity mail) { if (this.AccountLabels == null) //Si no fueron updateados los labels del fetcher (con método setLabels()) { return; //no se puede marcar los mails con los labels (se necesita el LabelEntity) } LabelEntity mailLabel = new LabelEntity(); gmLabels = gmLabels.Replace("\\", String.Empty); gmLabels = gmLabels.Replace("\"", String.Empty); //Gmail no pone el label de la carpeta actual donde se encuentra el mail gmLabels += " " + this.CurrentOpenedMailbox.Name; String[] labelsNames = gmLabels.Split(new Char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (String labelName in labelsNames) { mailLabel = (from accountLabel in this.AccountLabels where (accountLabel.Name == labelName || accountLabel.SystemName == labelName) select accountLabel).SingleOrDefault <LabelEntity>(); if (mailLabel != null) { mail.Labels.Add(mailLabel); } } }
private static void SetMailTo(MailEntity entity, MailMessage message) { foreach (string address in entity.To) { message.To.Add(address); } }
public bool Send(MailEntity entity) { MailMessage message = null; List <Attachment> attachments = null; try { var client = CreateClient(config); message = CreateMessage(entity); attachments = ConvertAttachments(entity); attachments.ForEach(i => message.Attachments.Add(i)); client.Send(message); return(true); } catch { return(false); } finally { // Dispose the stream. // Must dispose the stream after the message send completed. if (attachments != null && attachments.Count > 0) { attachments.ForEach(i => i.Dispose()); } if (message != null) { message.Dispose(); } } }
public static void SendEmail(MailEntity mailEntity) { TxtFileLogger logger = LoggerManager.GetLogger(); try { var mailService = ServiceBroker.FindService <IPP.Oversea.CN.ServiceCommon.ServiceInterfaces.ServiceContracts.ISendMail>(); var mail = new MailBodyV31 { Body = new MailBodyMsg { MailTo = mailEntity.To, CCMailAddress = mailEntity.CC, Subjuect = mailEntity.Subject, MailBody = mailEntity.Body, Status = 0, //0:未发送,1:已经发送 CreateDate = DateTime.Now, Priority = 1 // Normal } }; mail.Header = new MessageHeader(); mail.Header.CompanyCode = ConfigurationManager.AppSettings["CompanyCode"]; DefaultDataContract result = mailService.SendMail2IPP3Internal(mail); if (result.Faults != null && result.Faults.Count > 0) { throw new Exception(result.Faults[0].ErrorDescription); } } catch (Exception ex) { logger.WriteLog("邮件发送失败!\r\n" + ex.ToString()); } }
private MailEntity BuildEmail(DataRow drData) { MailEntity mail = new MailEntity(); mail.Body = new ItemAutoPricingDisableEmailBodyBuild().SetMailBody(drData); return(mail); }
public static void SendEmail(MailEntity mailEntity) { try { string baseUrl = System.Configuration.ConfigurationManager.AppSettings["CommonRestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; MailInfo mInfo = new MailInfo(); mInfo.Subject = mailEntity.Subject; mInfo.Body = mailEntity.Body; mInfo.FromName = mailEntity.From; mInfo.ToName = mailEntity.To; mInfo.CCName = mailEntity.CC; mInfo.Priority = 1; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; var ar = client.Create("/Message/SendMail", mInfo, out error); if (error != null && error.Faults != null && error.Faults.Count > 0) { throw new Exception(error.Faults[0].ErrorDescription); } } catch (Exception ex) { string errorLog = ConfigurationManager.AppSettings["ErrorLog"]; Log.WriteLog("邮件发送失败!\r\n" + ex.ToString(), errorLog); } }
public MailEntity BuildMailEntity ( string from = _testFrom, string fromName = _testFromName, string to = _testTo, string toName = _testToName, string subject = _testSubject, string body = _testBody, bool isHtml = _isHtmlTest ) { _mailEntity = new MailBuilder() .AddSystemPart(new SystemMailEntity { From = from, FromName = fromName, To = to, ToName = toName }) .AddText(body) .AddSubject(subject) .Build(); return(_mailEntity); }
private void EventTick(object state) { if (!Monitor.TryEnter(state)) { return; } if (_SSmtp != null) { do { EventQueueModel eventQueueModel; eventQueues.TryDequeue(out eventQueueModel); if (eventQueueModel != null) { Event _event = _SEvent.GetById(eventQueueModel.eventId); List <User> eventParticipants = _SEventParticipant.GetEventParticipants(_event.id); foreach (var item in eventParticipants) { MailEntity mailEntity = new MailEntity() { subject = String.Format("{0} Etkinliği Hakkında Bilgilendirme", _event.name), body = eventQueueModel.message, to = item.email }; Task.Run(() => _SSmtp.SendAsync(mailEntity)); string _json = JsonConvert.SerializeObject(mailEntity); Console.WriteLine(String.Format("Event Bildirim Gönderiliyor!\n{0}", _json)); } } } while (eventQueues.Count > 0); } Monitor.Exit(state); }
private void EventParticipantTick(object state) { if (!Monitor.TryEnter(state)) { return; } if (_SSmtp != null) { do { EventParticipantRequestQueueModel eventParticipantRequestQueueModel; eventParticipantRequestQueues.TryDequeue(out eventParticipantRequestQueueModel); if (eventParticipantRequestQueueModel != null) { Event _event = _SEvent.GetById(eventParticipantRequestQueueModel.eventId); User creatorUser = _SUser.GetById(_event.userId); User _user = _SUser.GetById(eventParticipantRequestQueueModel.userId); MailEntity mailEntity = new MailEntity() { subject = String.Format("{0} Etkinliğine Katılımcı İsteği", _event.name), body = String.Format("{0} {1} Kullanıcısı {2} İsimli Düzenlemiş Olduğunuz Etkinliğe Katılmak İstiyor.", _user.name, _user.surname, _event.name), to = creatorUser.email }; Task.Run(() => _SSmtp.SendAsync(mailEntity)); string _json = JsonConvert.SerializeObject(mailEntity); Console.WriteLine(String.Format("Etkinlik Katılımcı İsteği Gönderildi!\n{0}", _json)); } } while (eventParticipantRequestQueues.Count > 0); } Monitor.Exit(state); }
// POST: api/MailNotification public IHttpActionResult Post([FromBody] MailEntity entity) { try { var agent = new MailAgent( new MailConfig { SmtpServer = "*.com", Port = 25 }); CoerceEntity(entity); if (!agent.Send(entity)) { return(BadRequest()); } return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
private void EmailVerificationTick(object state) { if (!Monitor.TryEnter(state)) { return; } if (_SSmtp != null) { do { EmailVerificationQueueModel emailVerificationQueueModel; emailVerificationQueues.TryDequeue(out emailVerificationQueueModel); if (emailVerificationQueueModel != null) { string path = String.Format("{0}/ActivationAccount/{1}", connection.weburl, emailVerificationQueueModel.userGuid); MailEntity mailEntity = new MailEntity() { subject = "Email Aktivasyon İşlemi", to = emailVerificationQueueModel.email, body = String.Format("{0} E-Postalı Hesabınızı Oluşturduk. Giriş Yapabilmeniz İçin Sadece Aşağıdaki Bağlantıdan E-Posta Adresinizi Onaylamanız Gerekmektedir!\n" + "<a href='{1}'>Hesabı Aktifleştirmek İçin Buraya Tıkla</a>", emailVerificationQueueModel.email, path) }; Task.Run(() => _SSmtp.SendAsync(mailEntity)); string json = JsonConvert.SerializeObject(emailVerificationQueueModel); Console.WriteLine(String.Format("Kullanıcı E-Posta Aktivasyon Maili Gönderildi!\n{0}", json)); } } while (emailVerificationQueues.Count > 0); } Monitor.Exit(state); }
private void PasswordTick(object state) { if (!Monitor.TryEnter(state)) { return; } if (_SSmtp != null) { do { PasswordQueueModel passwordQueueModel; passwordQueues.TryDequeue(out passwordQueueModel); if (passwordQueueModel != null) { MailEntity mailEntity = new MailEntity() { subject = "Şifre Yenileme İsteği", body = String.Format("İsteğiniz Doğrultusunda {0} Hesabınızın Şifresi {1} Olarak Güncellenmiştir.", passwordQueueModel.email, passwordQueueModel.password), to = passwordQueueModel.email }; Task.Run(() => _SSmtp.SendAsync(mailEntity)); string _json = JsonConvert.SerializeObject(mailEntity); Console.WriteLine(String.Format("Kullanıcının Yeni Şifresi Gönderildi!\n{0}", _json)); } } while (passwordQueues.Count > 0); } Monitor.Exit(state); }
private Result GetMailResult ( MessageTemplateType type, SystemMailEntity systemMail, object additionalData, out MailEntity mail ) { mail = null; var result = new Result(); var template = _factory.GetMessageTemplate(type, additionalData); if (template == null) { result.Message = "Wrong tepmlate type."; return(result); } try { mail = template.GetMail(systemMail, additionalData); } catch (ArgumentException) { result.Message = "Can'nt build template. " + "Additional data has wrong type."; return(result); } result.Success = true; return(result); }
public List <AppDataManager.DataDesc> GetEmailUpdate() { LocalDb _MailDB = new LocalDb("MailHistory"); List <AppDataManager.DataDesc> FetchedData = new List <AppDataManager.DataDesc>(); System.Data.IDataReader reader = _MailDB.getMailDataUpdate(); while (reader.Read()) { MailEntity entity = new MailEntity(reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), reader[4].ToString(), reader[5].ToString(), "", "", "", "", "", "", ""); bool sentByPlayer = entity._isPlayer.Equals("True") ? true : false; FetchedData.Add(new EmailDataManager.EmailDataDesc(int.Parse(entity._id), entity._speaker, sentByPlayer, entity._subject, entity._content, int.Parse(entity._sitID))); } _MailDB.close(); return(FetchedData); }
public bool SendTo(ConfigEntity configEntity, MailEntity message, string mailActionValue) { if (string.IsNullOrEmpty(mailActionValue)) { Console.WriteLine("Почтовый ящик не указан!"); return(false); } Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"\nForward: {mailActionValue}"); Console.ForegroundColor = ConsoleColor.Gray; StringBuilder mailFrom = new StringBuilder(); mailFrom.Append(configEntity.Mail); mailFrom.Replace("pop.", ""); MailAddress from = new MailAddress(configEntity.Login + "@" + mailFrom); MailAddress to = new MailAddress(mailActionValue); MailMessage m = new MailMessage(from, to) { Subject = message.Subject, Body = message.Body.ToString() }; SmtpClient smtp = new SmtpClient("smtp." + mailFrom, 587) { Credentials = new NetworkCredential(configEntity.Login, configEntity.Password), EnableSsl = true }; smtp.SendMailAsync(m); Console.WriteLine("Письмо отправлено"); return(true); }
public async Task <bool> SaveMailInfo([FromBody] MailEntity mailEntity) { mailData = mailEntity; await System.IO.File.WriteAllTextAsync(filePath, JsonConvert.SerializeObject(mailEntity)); return(true); }
private static void ProcessEachForRigister(Coupon master) { //获取注册未发放优惠券的顾客 (实时发)5分钟一次,造优惠券,发给顾客 string userType = "R"; List <Customer> customerList = CouponDA.GetRegisterUser(userType, master);//获取注册未发放优惠券的顾客 if (customerList == null || customerList.Count <= 0) { WriteLog("没能查询到符合条件的用户"); return; } WriteLog("查询到新注册的用户" + customerList.Count + "个"); master.BindStatus = "S";//字段 CouponDA.UpdateBindRulesStatus(master); int num = 0; string userList = string.Empty; foreach (Customer customer in customerList) { #region CreateCode CouponCode codeEntity = new CouponCode(); codeEntity.CouponSysNo = master.SysNo; codeEntity.CodeType = "C"; codeEntity.CustomerMaxFrequency = 1; GetCodeExpireDate(master, codeEntity); codeEntity = CouponDA.CreateCode(codeEntity); #endregion CouponCodeCustomerLog logEntity = new CouponCodeCustomerLog(); logEntity.CouponCode = codeEntity.Code; logEntity.CouponSysNo = master.SysNo; logEntity.CustomerSysNo = customer.CustomerSysNo; logEntity.UserCodeType = userType; CouponDA.InsertCustomerLog(logEntity); #region sendMail MailEntity customerMail = new MailEntity(); customerMail.MailSubject = master.CouponName; if (!string.IsNullOrEmpty(customer.MailAddress) && master.IsSendMail == "Y") { customerMail.MailBody = ConstValues.MailTemplate.Replace("@InDate", DateTime.Now.ToString("yyyy-MM-dd")) .Replace("@CustomerHello@", customer.CustomerID) .Replace("@CouponCode@", codeEntity.Code) .Replace("@nums@", "1") .Replace("@EndDateStr@", codeEntity.EndDate.ToString("yyyy-MM-dd")); customerMail.MailAddress = customer.MailAddress; CouponDA.SendMailInfo(customerMail); } #endregion num++; userList += "顾客编号:" + customer.CustomerSysNo + ",顾客ID:" + customer.CustomerID + "\r\n"; } WriteLog(DateTime.Now + "注册送优惠券成功发送" + num + "个顾客,分别是:\r\n" + userList); }
public void Search_For_Mail_With_Max_Int_Id_Returns_Null_Result() { MailEntity myMail = this.session.CreateCriteria <MailEntity>() .Add(Restrictions.Eq("Id", Int64.MaxValue)) .UniqueResult <MailEntity>(); Assert.IsNull(myMail); }
public void Search_For_Mail_With_Id_1_And_Return_Unique_Result() { MailEntity myMail = this.session.CreateCriteria <MailEntity>() .Add(Restrictions.Eq("Id", Convert.ToInt64(1))) .UniqueResult <MailEntity>(); Assert.NotNull(myMail); }
private static void ProcessEachForTBVip_Old(Coupon master) { string userType = "Z"; //触发条件 master.BindStatus = "S"; //发放状态 List <Customer> customerList = CouponDA.GetAlipayCustomer(userType, master);//获取未发放优惠券的顾客 WriteLog("获取用户数" + customerList.Count + "个"); if (customerList.Count <= 0) { WriteLog("没有找到符合条件的支付宝金账户"); } else { using (TransactionScope ts = new TransactionScope()) { string message = string.Format("({0}){1} -- ", master.SysNo, master.CouponName); //通用型优惠券代码 CouponCode code = CouponDA.QueryBindingCode(master); CouponDA.UpdateBindRulesStatus(master); int index = 0; string userList = string.Empty; CouponCodeCustomerLog logEntity = new CouponCodeCustomerLog(); logEntity.CouponCode = code.Code; logEntity.CouponSysNo = master.SysNo; MailEntity customerMail = new MailEntity(); customerMail.MailSubject = master.CouponName; foreach (Customer customer in customerList) { logEntity.CustomerSysNo = customer.CustomerSysNo; logEntity.UserCodeType = userType; CouponDA.InsertCustomerLog(logEntity); if (!string.IsNullOrEmpty(customer.MailAddress) && master.IsSendMail == "Y") { customerMail.MailBody = ConstValues.MailTemplate.Replace("@Title@", master.CouponName) .Replace("@CustomerHello@", "您好,感谢您对大昌优品的支持。") .Replace("@CouponCode@", code.Code) .Replace("@nums@", code.CustomerMaxFrequency.ToString()) .Replace("@EndDateStr@", code.EndDate.ToString("yyyy-MM-dd")); customerMail.MailAddress = customer.MailAddress; CouponDA.SendMailInfo(customerMail); } ++index; userList += "顾客编号:" + customer.CustomerSysNo + ",顾客ID:" + customer.CustomerID + "\r\n"; } WriteLog(DateTime.Now + "支付宝金账户优惠券成功发送" + index + "个顾客,分别是:\r\n" + userList); ts.Complete(); } } }
/// <summary> /// 支付宝金账户发放优惠券 /// </summary> /// <param name="item"></param> private static void ProcessEachForTBVip(Coupon master) { string userType = "Z"; //触发条件 master.BindStatus = "S"; //发放状态 List <Customer> customerList = null; customerList = CouponDA.GetAlipayCustomer(userType, master);//获取未发放优惠券的顾客 if (customerList.Count <= 0) { WriteLog("没有找到符合条件的支付宝金账户"); return; } //更新绑定状态为S CouponDA.UpdateBindRulesStatus(master); int num = 0; string userList = string.Empty; foreach (Customer customer in customerList) { #region CreateCode CouponCode codeEntity = new CouponCode(); codeEntity.CouponSysNo = master.SysNo; GetCodeExpireDate(master, codeEntity); codeEntity = CouponDA.CreateCode(codeEntity); #endregion CouponCodeCustomerLog logEntity = new CouponCodeCustomerLog(); logEntity.CouponCode = codeEntity.Code; logEntity.CouponSysNo = master.SysNo; logEntity.CustomerSysNo = customer.CustomerSysNo; logEntity.UserCodeType = userType; CouponDA.InsertCustomerLog(logEntity); #region sendMail MailEntity customerMail = new MailEntity(); customerMail.MailSubject = master.CouponName; if (!string.IsNullOrEmpty(customer.MailAddress) && master.IsSendMail == "Y") { customerMail.MailBody = ConstValues.MailTemplate.Replace("@InDate", DateTime.Now.ToString("yyyy-MM-dd")) .Replace("@CustomerHello@", customer.CustomerID) .Replace("@CouponCode@", codeEntity.Code) .Replace("@nums@", "1") .Replace("@EndDateStr@", codeEntity.EndDate.ToString("yyyy-MM-dd")); customerMail.MailAddress = customer.MailAddress; CouponDA.SendMailInfo(customerMail); } #endregion num++; userList += "顾客编号:" + customer.CustomerSysNo + ",顾客ID:" + customer.CustomerID + "\r\n"; } WriteLog(DateTime.Now + "支付宝金账户送优惠券成功发送" + num + "个顾客,分别是:\r\n" + userList); }
public Mail(Int64 mailId, ISession session) { MailEntity entity = session.CreateCriteria <MailEntity>() .Add(Restrictions.Eq("Id", mailId)) .SetMaxResults(1) .UniqueResult <MailEntity>(); this.Entity = entity; }
private List <Attachment> ConvertAttachments(MailEntity entity) { var attachments = new List <Attachment>(); foreach (var item in entity.Attachments) { attachments.Add(item.ToAttachment()); } return(attachments); }
/// <summary> /// 获取eMail信息 /// </summary> /// <returns></returns> public async Task <MailEntity> GetMailInfo() { if (mailData == null) { var mail = await System.IO.File.ReadAllTextAsync(filePath); mailData = JsonConvert.DeserializeObject <MailEntity>(mail); } return(mailData); }
public IEnumerable <MailEntity> GetTransactionDetails(ListMessagesResponse listMessages, GmailService service) { foreach (var email in listMessages.Messages) { entity = new MailEntity(); var emailInfoRequest = service.Users.Messages.Get("me", email.Id); var emailInfoResponse = emailInfoRequest.Execute(); if (emailInfoResponse != null) { String from = ""; String date = ""; String subject = ""; //loop through the headers to get from,date,subject, body foreach (var mParts in emailInfoResponse.Payload.Headers) { if (mParts.Name == "Date") { int index = mParts.Value.LastIndexOf(':') + 3; string datepulled = mParts.Value.Remove(index, mParts.Value.Length - index); DateTime dt; while (!DateTime.TryParse(datepulled, out dt)) { datepulled = datepulled.Remove(0, 1); } entity.DOT = Convert.ToDateTime(datepulled); //datepulled = datepulled.Remove(index, datepulled.Length - index).Trim(); entity.DOT = Convert.ToDateTime(datepulled); } else if (mParts.Name == "From") { entity.From = mParts.Value; } else if (mParts.Name == "Subject") { entity.Subject = mParts.Value; } if (entity.DOT != null && !string.IsNullOrWhiteSpace(entity.From) && emailInfoResponse.Payload.Body != null && !string.IsNullOrWhiteSpace(entity.Subject)) { if (emailInfoResponse.Payload.MimeType == "text/html") { byte[] data = FromBase64ForUrlString(emailInfoResponse.Payload.Body.Data); entity.Body = Encoding.UTF8.GetString(data); lstentity.Add(entity); } } } } } return(lstentity); }
private static void SendMail(List <TaobaoProduct> ThirdPartMappingNotExists) { SendMailBiz biz = new SendMailBiz(); int PageSize = Config.MailContentPageSize; int page = 1; int PageCount = 1; int records = ThirdPartMappingNotExists == null ? 0 : ThirdPartMappingNotExists.Count; List <MailEntity> mailList = new List <MailEntity>(); string template = biz.GetMailTemplate(MailType.ThirdPartMappingNotExists); if (records > 0) { PageCount = records <= PageSize ? 1 : (records % PageSize == 0 ? records / PageSize : records / PageSize + 1); for (; page <= PageCount; page++) { var list = ThirdPartMappingNotExists.Skip((page - 1) * PageSize).Take(PageSize).ToList(); string ThirdPartMappingNotExists_Body = biz.CreateBody(list); string templateResult = template.Replace("$ThirdPartMappingNotExists$", ThirdPartMappingNotExists_Body); templateResult = templateResult.Replace("$ThirdPartMappingNotExists_Count$", list.Count.ToString()); MailEntity entity = new MailEntity { Body = templateResult, CC = Config.MailCCAddress, From = Config.MailFrom, Subject = Config.MailSubject, To = Config.MailAddress }; entity.Subject += "_淘宝存在的商品,本地Mapping无映射"; if (PageCount > 1) { entity.Subject += string.Format("_数据总量({0})_第{1}页({2})", records, page, list.Count); } //biz.SendMail(entity); mailList.Add(entity); } } else { string templateResult = template.Replace("$ThirdPartMappingNotExists$", ""); templateResult = templateResult.Replace("$ThirdPartMappingNotExists_Count$", "0"); MailEntity entity = new MailEntity { Body = templateResult, CC = Config.MailCCAddress, From = Config.MailFrom, Subject = Config.MailSubject, To = Config.MailAddress }; entity.Subject += "_淘宝存在的商品,本地Mapping无映射"; mailList.Add(entity); } SendMail(mailList); }
public void TestInitialize() { Debug.WriteLine("Test Initialize"); MailEntity = new MailEntity(); MailEntity.To.Add(new MailAddress("*****@*****.**")); MailEntity.From = new MailAddress("*****@*****.**"); MailEntity.Subject = "1 письмо"; MailEntity.Body = new StringBuilder("вап ваппррр"); MailEntity.DateSent = DateTime.Now; ConfigEntity = new ConfigEntity { MailActions = new[] { new Config.MailAction { ActType = ActionType.Notify, ActTypeValue = "yes" }, new Config.MailAction { ActType = ActionType.Print, ActTypeValue = "yes" }, new Config.MailAction { ActType = ActionType.CopyTo, ActTypeValue = "folder" }, new Config.MailAction { ActType = ActionType.Forward, ActTypeValue = "*****@*****.**" }, }, IdentityMessages = new[] { new IdentityMessage { IdType = IdentityType.To, IdTypeValue = "*****@*****.**" }, new IdentityMessage { IdType = IdentityType.From, IdTypeValue = "*****@*****.**" }, new IdentityMessage { IdType = IdentityType.Title, IdTypeValue = "пис" }, new IdentityMessage { IdType = IdentityType.Body, IdTypeValue = "вап" } }, Mail = "pop.yandex.ru", Port = 995, Login = "******", Password = "******" }; MailTransfer = new MailTransfer(); MailTransfer.MailEntities.Add(MailEntity); MailTransfer.Uids.Add("1542704384292"); }
public void Post([FromBody] MailEntity value) { try { //string email, subject, message; _mailService.SendEmail(value.email, value.subject, value.message); } catch (Exception) { throw; } }